mirror of
https://github.com/prymitive/karma
synced 2026-05-07 03:26:52 +00:00
Use Docker multi-stage builds to reduce final docker image size
For second stage use https://github.com/GoogleCloudPlatform/distroless which provides a minimal image with CA certificates. Binary is compiled with CGO_ENABLED=0 to prevent dynamical linking to any libraries.
This commit is contained in:
17
Dockerfile
17
Dockerfile
@@ -1,16 +1,11 @@
|
||||
FROM golang:1.8.3-alpine
|
||||
|
||||
FROM golang:1.8.3-alpine3.6 as unsee-builder
|
||||
COPY . /go/src/github.com/cloudflare/unsee
|
||||
|
||||
ARG VERSION
|
||||
RUN apk add --update make git nodejs nodejs-npm
|
||||
RUN CGO_ENABLED=0 make -C /go/src/github.com/cloudflare/unsee VERSION="${VERSION:-dev}" unsee
|
||||
|
||||
RUN apk add --update --no-cache --virtual .build-dependencies \
|
||||
make git nodejs && \
|
||||
make -C /go/src/github.com/cloudflare/unsee VERSION="${VERSION:-dev}" && \
|
||||
mv /go/src/github.com/cloudflare/unsee/unsee /bin/unsee && \
|
||||
rm -fr /go/src && \
|
||||
apk del .build-dependencies
|
||||
|
||||
FROM gcr.io/distroless/base
|
||||
COPY --from=unsee-builder /go/src/github.com/cloudflare/unsee/unsee /unsee
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["unsee"]
|
||||
CMD ["/unsee"]
|
||||
|
||||
Reference in New Issue
Block a user