Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
Expand All @@ -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

Expand Down
Loading