build(Containerfile): do not run as root inside the container

This commit is contained in:
Job 2024-02-01 20:00:47 +01:00
parent 82f40bcaea
commit caa7146c22
Signed by: Job79
SSH Key Fingerprint: SHA256:BezbKv3jZaqu7SdNrZM0e42b8nlNwh63zaVj/pUxc7U

@ -20,7 +20,10 @@ RUN case "$(apk --print-arch)" in \
FROM alpine:3.19
WORKDIR /app
RUN mkdir /app/wwwroot
RUN mkdir wwwroot data && \
adduser -D appuser && \
chown appuser:appuser data
# /* removes directory structure
COPY --from=builder /release/* /app
@ -28,5 +31,6 @@ COPY ./about.html /app/about.html
COPY --from=frontend-builder /build/dist /app/wwwroot
ENV WWW_DIR /app/wwwroot
USER appuser
EXPOSE 8080
CMD [ "./pastabble" ]