@@ -11,7 +11,7 @@ RUN dnf --disableplugin subscription-manager -y --allowerasing update \
1111 && dnf --disableplugin subscription-manager -y install pcre-devel nmap-ncat \
1212 && dnf --disableplugin subscription-manager -y clean all
1313
14- COPY scripts /scripts
14+ COPY --chmod=0550 --chown=1000:0 scripts /scripts
1515ENV PATH="/scripts:${PATH}"
1616
1717RUN setup_user.sh
@@ -26,13 +26,13 @@ RUN mkdir -p /usr/local/lib/uwsgi/plugins && chown -R 1000:0 /usr/local/lib/uwsg
2626
2727WORKDIR /app
2828
29- COPY --chown=1000:0 requirements.txt /app/requirements.txt
29+ COPY --chmod=0440 -- chown=1000:0 requirements.txt /app/requirements.txt
3030
3131RUN pip install -U pip setuptools wheel \
3232 && pip install --no-cache-dir -r /app/requirements.txt
3333
3434 # Build and copy specific python-uwsgi-common files.
35- ADD https://github.com/City-of-Helsinki/python-uwsgi-common/archive/${UWSGI_COMMON_REF}.tar.gz /usr/src/
35+ ADD --chmod=0440 https://github.com/City-of-Helsinki/python-uwsgi-common/archive/${UWSGI_COMMON_REF}.tar.gz /usr/src/
3636RUN mkdir -p /usr/src/python-uwsgi-common && \
3737 tar --strip-components=1 -xzf /usr/src/${UWSGI_COMMON_REF}.tar.gz -C /usr/src/python-uwsgi-common && \
3838 cp /usr/src/python-uwsgi-common/uwsgi-base.ini /app && \
@@ -45,7 +45,7 @@ RUN mkdir -p /usr/src/python-uwsgi-common && \
4545
4646USER 1000
4747
48- COPY --chown=1000:0 docker-entrypoint.sh /entrypoint/docker-entrypoint.sh
48+ COPY --chmod=0555 -- chown=1000:0 docker-entrypoint.sh /entrypoint/docker-entrypoint.sh
4949ENTRYPOINT ["/entrypoint/docker-entrypoint.sh" ]
5050
5151EXPOSE 8000/tcp
@@ -54,19 +54,19 @@ EXPOSE 8000/tcp
5454FROM appbase AS development
5555# ==============================
5656
57- COPY --chown=1000:0 requirements-dev.txt ./requirements-dev.txt
57+ COPY --chmod=0440 -- chown=1000:0 requirements-dev.txt ./requirements-dev.txt
5858RUN pip install --no-cache-dir -r ./requirements-dev.txt
5959
6060ENV DEV_SERVER=1
6161
62- COPY --chown=1000:0 . /app/
62+ COPY --chmod=0750 -- chown=1000:0 . /app/
6363
6464# ==============================
6565FROM appbase AS staticbuilder
6666# ==============================
6767
6868ENV STATIC_ROOT=/var/static
69- COPY --chown=1000:0 . /app/
69+ COPY --chmod=0555 -- chown=1000:0 . /app/
7070RUN SECRET_KEY="only-used-for-collectstatic" python manage.py collectstatic --noinput
7171
7272# ==============================
@@ -76,5 +76,5 @@ FROM appbase AS production
7676# fatal: detected dubious ownership in repository at '/app'
7777RUN git config --global --add safe.directory /app
7878
79- COPY --from=staticbuilder --chown=1000:0 /var/static /var/static
80- COPY --chown=1000:0 . /app/
79+ COPY --from=staticbuilder --chmod=0555 -- chown=1000:0 /var/static /var/static
80+ COPY --chmod=0555 -- chown=1000:0 . /app/
0 commit comments