Skip to content

Commit

Permalink
docker镜像多阶段构建
Browse files Browse the repository at this point in the history
  • Loading branch information
ouqiang committed May 18, 2018
1 parent f24d306 commit 4f7a5cf
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
@@ -1,2 +1,2 @@
.git
node_modules
web/vue/node_modules
30 changes: 30 additions & 0 deletions Dockerfile
@@ -0,0 +1,30 @@
FROM golang:1.10-alpine as builder

WORKDIR /go/src/github.com/ouqiang/gocron

COPY . .

RUN apk update \
&& apk add --no-cache git ca-certificates make bash nodejs yarn

RUN make install-vue \
&& make build-vue \
&& make statik \
&& CGO_ENABLED=0 make gocron

FROM alpine:3.7

RUN addgroup -S app \
&& adduser -S -g app app

WORKDIR /app

COPY --from=builder /go/src/github.com/ouqiang/gocron/bin/gocron .

RUN chown -R app:app ./

EXPOSE 5920

USER app

ENTRYPOINT ["/app/gocron", "web"]
9 changes: 0 additions & 9 deletions Dockerfile-release

This file was deleted.

2 changes: 1 addition & 1 deletion makefile
Expand Up @@ -48,7 +48,7 @@ build-vue:

.PHONY: install-vue
install-vue:
cp web/vue && yarn install
cd web/vue && yarn install

.PHONY: statik
statik:
Expand Down

0 comments on commit 4f7a5cf

Please sign in to comment.