-
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
99194db
commit a7e483e
Showing
2 changed files
with
13 additions
and
4 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,14 +1,17 @@ | ||
|
||
FROM registry.access.redhat.com/ubi8/ubi-minimal AS builder | ||
RUN microdnf install -y shadow-utils && microdnf clean all | ||
RUN set -o pipefail && groupadd -r -g 1000 gouser && useradd -r -u 1000 -g gouser -m -d /opt/gouser -s /bin/bash gouser && cat /etc/passwd | grep gouser > /etc/passwd_gouser | ||
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 --from=builder /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ | ||
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