Post

Docker layers

Docker layers

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
cat  Dockerfile
FROM ubuntu
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && apt-get install golang-go -y
COPY app.go .
RUN CGO_ENABLED=0 go build app.go


FROM alpine:3.12.1
RUN chmod a-w /etc && \
  addgroup -S appgroup && adduser -S appuser -G appgroup -h /home/appuser && \
  rm -rf /bin/*
COPY --from=0 /app /home/appuser
USER appuser
CMD ["/home/appuser/app"]

This post is licensed under CC BY 4.0 by the author.