Last active
July 30, 2024 11:29
-
-
Save Lauriy/22b305a925d8a21bf496c87b0419de1b to your computer and use it in GitHub Desktop.
Dockerfile stage that installs uWSGI and sets non-root permissions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM base AS production | |
# Let's allow .pycs again | |
ENV PYTHONDONTWRITEBYTECODE=0 | |
# Needed to compile uwsgi, clean up after | |
RUN --mount=type=cache,target=/var/cache/apt apt-get update && apt-get install -y --no-install-recommends \ | |
build-essential \ | |
python3-dev \ | |
libpcre3-dev \ | |
&& apt-get clean && rm -rf /var/lib/apt/lists/* | |
RUN --mount=type=cache,target=/root/.cache/pip pip --no-cache-dir install uwsgi | |
COPY uwsgi.ini ./ | |
# Best practice not to give pwners free root | |
RUN useradd -m docker | |
RUN mkdir -p /home/docker/rik_proovitöö/run /home/docker/rik_proovitöö/static_collected | |
RUN chown -R docker:docker /home/docker/rik_proovitöö | |
RUN chmod 755 /home/docker/rik_proovitöö/run | |
USER docker | |
COPY rik_proovitöö ./rik_proovitöö |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment