File tree Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ web /node_modules
2+ tools /
3+ target /
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ DEBUG ?= true
88all : build
99
1010include build.mk
11+ include docker.mk
1112
1213.PHONY :run
1314run :
Original file line number Diff line number Diff line change 1+ FROM node:13-alpine as ui-build
2+ COPY web .
3+ RUN yarn install --silent && yarn build
4+
5+ FROM golang:1.13-alpine as build
6+ COPY cmd ./cmd
7+ COPY pkg ./pkg
8+ COPY go.mod .
9+ COPY go.sum .
10+ RUN go build -o server ./cmd/playground
11+
12+ FROM golang:1.13-alpine as production
13+ WORKDIR /opt/playground
14+ COPY data ./data
15+ COPY --from=ui-build web/build ./public
16+ COPY --from=build server .
17+ EXPOSE 8000
18+ CMD ['/opt/playground/server' , '-f=/opt/playground/data/packages.json' ]
Original file line number Diff line number Diff line change 1+ DOCKERFILE ?= ./build/Dockerfile
2+ IMG_NAME ?= x1unix/go-playground
3+ TAG ?= 1.0.0
4+
5+ .PHONY : docker
6+ docker : docker-login docker-make-image
7+ @echo " - Pushing $( IMG_NAME) :$( TAG) (as latest)...'
8+ docker push $(IMG_NAME ) :$(TAG )
9+ docker push $(IMG_NAME ) :latest
10+
11+ .PHONY : docker-login
12+ docker-login :
13+ @if [ -z " $( DOCKER_USER) " ]; then\
14+ echo " required parameter DOCKER_USER is undefined" && exit 1; \
15+ fi ;
16+ @if [ -z " $( DOCKER_PASS) " ]; then\
17+ echo " required parameter DOCKER_PASS is undefined" && exit 1; \
18+ fi ;
19+ @docker login -u $(DOCKER_USER ) -p $(DOCKER_PASS ) && echo " - Docker login success" ;
20+
21+ .PHONY : docker-make-image
22+ docker-make-image :
23+ @echo " - Building '$( IMG_NAME) :latest' $( TAG) ..."
24+ docker image build -t $(IMG_NAME ) :latest -t $(IMG_NAME ) :$(TAG ) -f $(DOCKERFILE ) .
You can’t perform that action at this time.
0 commit comments