-
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
5a863bf
commit 99194db
Showing
2 changed files
with
12 additions
and
3 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 |
---|---|---|
|
@@ -20,4 +20,5 @@ | |
# Go workspace file | ||
go.work | ||
go.work.sum | ||
.idea | ||
.idea | ||
/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 |
---|---|---|
@@ -1,6 +1,14 @@ | ||
FROM golang:alpine | ||
|
||
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 scratch | ||
ARG VERSION | ||
ENV VERSION=${VERSION} | ||
ENTRYPOINT ["/noah-mqtt"] | ||
COPY noah-mqtt / | ||
COPY LICENSE / | ||
COPY --from=builder /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ | ||
COPY --from=builder /etc/passwd_gouser /etc/passwd | ||
USER gouser | ||
ENTRYPOINT ["/noah-mqtt"] |