Skip to content

Commit

Permalink
docker: Fix missing /tmp directory
Browse files Browse the repository at this point in the history
This caused issues in various areas where Pat (and/or dependencies)
relied on os.TempDir() store temporary files. E.g. when running `pat
updateforms`.

We can't do this inside the build container, as there is no way of
specifying file permissions when doing COPY --from. The solution
(inspired by the distroless images) is to ADD a pre-prepared tarball
with the correct file permissions.

`mkdir -m 01777 tmp && tar --owner=root --group=root -cf tmp.tar tmp`
  • Loading branch information
martinhpedersen committed Feb 19, 2024
1 parent 9fe80af commit b518889
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Binary file added .docker/tmp.tar
Binary file not shown.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ FROM scratch
LABEL org.opencontainers.image.source=https://github.com/la5nta/pat
LABEL org.opencontainers.image.description="Pat - A portable Winlink client for amateur radio email"
LABEL org.opencontainers.image.licenses=MIT
# Make sure we have a /tmp directory with the correct permissions (01777)
ADD .docker/tmp.tar /
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
COPY --from=builder /src/pat /bin/pat
USER 65534:65534
Expand Down

0 comments on commit b518889

Please sign in to comment.