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

Improve docker file to leverage stages for cache #50

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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