Skip to content

Commit 9cf2d78

Browse files
committed
test distroless image
1 parent f55089c commit 9cf2d78

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

Dockerfile.distroless

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,26 @@ RUN apk add --no-cache gcc libstdc++-dev libc-dev
1818
RUN cd /gnfd-qa-test-monitor \
1919
&& go build -o ./build/monitor main.go
2020

21-
RUN cd /gnfd-qa-test-monitor && pwd && ls -al
21+
RUN cd /gnfd-qa-test-monitor/build && pwd && ls -al
2222

2323
FROM alpine:3.17
2424

25-
USER nonroot:nonroot
26-
WORKDIR /home/nonroot
27-
# COPY --from=builder --chown=nonroot:nonroot /gnfd-qa-test-monitor/build/monitor $WORKDIR
28-
COPY --from=builder /gnfd-qa-test-monitor/build/monitor $WORKDIR
25+
ARG USER=sp
26+
ARG USER_UID=1000
27+
ARG USER_GID=1000
28+
29+
ENV WORKDIR=/app
30+
31+
WORKDIR ${WORKDIR}
32+
33+
COPY --from=builder /gnfd-qa-test-monitor/build/* ${WORKDIR}/
34+
RUN chown -R ${USER_UID}:${USER_GID} ${WORKDIR}
35+
USER ${USER_UID}:${USER_GID}
2936
RUN cd /gnfd-qa-test-monitor && pwd && ls -al
30-
ENTRYPOINT ["./monitor"]
37+
ENTRYPOINT ["/app/monitor"]
38+
39+
# USER nonroot:nonroot
40+
# WORKDIR /home/nonroot
41+
# COPY --from=builder --chown=nonroot:nonroot /gnfd-qa-test-monitor/build/monitor $WORKDIR
42+
# RUN cd /gnfd-qa-test-monitor && pwd && ls -al
43+
# ENTRYPOINT ["./monitor"]

0 commit comments

Comments
 (0)