Remove user creation and use UID/GID 8000 to run process

This commit is contained in:
Paul-Christian Volkmer 2023-09-02 14:53:50 +02:00
parent 925f4c3f5a
commit ec33b402b9

View File

@ -1,17 +1,5 @@
FROM golang:1.20-alpine AS build-env
ENV USER=appuser
ENV UID=8000
RUN adduser \
--disabled-password \
--gecos "" \
--home "/null" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"
WORKDIR /tmp/build
ADD . /tmp/build
# -ldlflags '-s' to strip binary
@ -25,11 +13,9 @@ LABEL org.opencontainers.image.source = "https://github.com/pcvolkmer/idicon"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.description="Simple identicon service"
COPY --from=build-env /etc/passwd /etc/passwd
COPY --from=build-env /etc/group /etc/group
COPY --from=build-env /tmp/build/app /idicon
USER appuser:appuser
USER 8000:8000
EXPOSE 8000