Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
Improve docker file to leverage stages for cache
Browse files Browse the repository at this point in the history
  • Loading branch information
drubin committed Nov 27, 2018
1 parent 97545f4 commit a3ac9c9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions docker/catalogue/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM golang:1.7

COPY . /go/src/github.com/microservices-demo/catalogue
COPY vendor/manifest /go/src/github.com/microservices-demo/catalogue/vendor/manifest
WORKDIR /go/src/github.com/microservices-demo/catalogue

RUN go get -u github.com/FiloSottile/gvt
RUN gvt restore && \
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /app github.com/microservices-demo/catalogue/cmd/cataloguesvc
RUN gvt restore
COPY . /go/src/github.com/microservices-demo/catalogue/
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /app github.com/microservices-demo/catalogue/cmd/cataloguesvc

FROM alpine:3.4

Expand All @@ -19,9 +20,10 @@ RUN addgroup -g ${SERVICE_GID} ${SERVICE_GROUP} && \
apk add --update libcap

WORKDIR /
COPY --from=0 /app /app
COPY images/ /images/

COPY --from=0 /app /app

RUN chmod +x /app && \
chown -R ${SERVICE_USER}:${SERVICE_GROUP} /app /images && \
setcap 'cap_net_bind_service=+ep' /app
Expand All @@ -43,4 +45,4 @@ LABEL org.label-schema.vendor="Weaveworks" \
org.label-schema.schema-version="1.0"

CMD ["/app", "-port=80"]
EXPOSE 80
EXPOSE 80

0 comments on commit a3ac9c9

Please sign in to comment.