Last active
March 23, 2019 19:22
-
-
Save DahlitzFlorian/1b1485fd4dcf83b65a8a23e18e6fc47d to your computer and use it in GitHub Desktop.
Run Python application as non-root in Docker - Pipenv
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 python:3.7.2-alpine | |
| RUN pip install --upgrade pip | |
| RUN adduser -D worker | |
| USER worker | |
| WORKDIR /home/worker | |
| RUN pip install --user pipenv | |
| ENV PATH="/home/worker/.local/bin:${PATH}" | |
| COPY --chown=worker:worker Pipfile Pipfile | |
| RUN pipenv lock -r > requirements.txt | |
| RUN pip install --user -r requirements.txt | |
| COPY --chown=worker:worker . . | |
| CMD ["python"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment