-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build docker image from scratch to reduce runtime dependencies
- Loading branch information
1 parent
a7e483e
commit da2592c
Showing
2 changed files
with
2 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
gouser:x:1000:1000:Linux User,,,:/home/gouser:/bin/sh |