diff --git a/Dockerfile b/Dockerfile index a63695c..48a1e81 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,6 +49,9 @@ RUN for binary in /app/bin/*; do \ xargs -I % sh -c 'mkdir -p $(dirname deps%); cp % deps%;'; \ done +# Create tmp directory with proper permissions +RUN rm -rf /tmp && mkdir -p /tmp && chmod 1777 /tmp + # Build a minimal docker image FROM scratch WORKDIR / @@ -72,6 +75,16 @@ COPY --from=build /usr/share/zoneinfo/ /usr/share/zoneinfo/ COPY --from=build /app/deps / COPY --from=build /app/bin / +# Copy tmp directory +COPY --from=build /tmp /tmp + +# chmod for setting permissions on /tmp +COPY --from=build /bin /bin +COPY --from=build /lib/ld-musl-* /lib/ +RUN chmod -R a+rwX /tmp +# hadolint ignore=SC2114,DL3059 +RUN rm -rf /bin /lib + # Use an unprivileged user. USER appuser:appuser