Set file permissions correctly immediately (#799)
Some checks are pending
Build CI / iOS UI tests (push) Waiting to run
Build CI / build (push) Waiting to run
Build CI / static-analysis (push) Waiting to run
Build CI / android-instrumented-tests (push) Waiting to run
Build CI / iOS compile & test (push) Waiting to run
PublishInternal / publish-google-play (push) Waiting to run

Perform the chown on the files copied into /opt/hammer during the COPY instruction, instead of during a separate RUN instruction. This prevents the files from being 'duplicated' due to having been changed on the layer for the RUN instruction. Effectively, this reduces the size of the layer for the RUN instruction from about 211 MB to approximately 0.
This commit is contained in:
Xander Smeets 2026-07-31 17:50:51 +02:00 • committed by GitHub
parent 5acba72867
commit ff8b278195
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -29,13 +29,13 @@ RUN groupadd --gid 1000 hammer \
ENV SERVER_OPTS="-Duser.home=/data"
ARG DIST_DIR=server/build/install/server
COPY ${DIST_DIR}/ /opt/hammer/
COPY --chown=1000:1000 ${DIST_DIR}/ /opt/hammer/
# hammer_data itself must exist and be owned here: bind-mounting a config file
# into it would otherwise have Docker create the parent as root, leaving the
# unprivileged server unable to write pgdata.
RUN mkdir -p /data/hammer_data \
&& chown -R hammer:hammer /data /opt/hammer
&& chown -R hammer:hammer /data
USER hammer
WORKDIR /opt/hammer