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 509e193
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 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 Down

0 comments on commit 509e193

Please sign in to comment.