Skip to content

Commit

Permalink
build docker image from scratch to reduce runtime dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrossbach committed Jul 29, 2024
1 parent a7e483e commit da2592c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@

FROM alpine AS builder
RUN apk update && apk upgrade && apk add --no-cache ca-certificates
RUN update-ca-certificates
RUN set -o pipefail && addgroup --gid 1000 gouser && adduser --disabled-password --no-create-home --ingroup gouser gouser
RUN cat /etc/passwd
RUN cat /etc/passwd | grep gouser > /etc/passwd_gouser

FROM scratch
ARG VERSION
ENV VERSION=${VERSION}
COPY noah-mqtt /
COPY LICENSE /
COPY passwd /etc/passwd
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /etc/passwd_gouser /etc/passwd
USER gouser
ENTRYPOINT ["/noah-mqtt"]
1 change: 1 addition & 0 deletions passwd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gouser:x:1000:1000:Linux User,,,:/home/gouser:/bin/sh

0 comments on commit da2592c

Please sign in to comment.