Last active
February 2, 2022 09:49
-
-
Save mrpbennett/dbebabe0d46f0df0c2d6e6b57a11a44c to your computer and use it in GitHub Desktop.
Flask Docker file
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
# For more information, please refer to https://aka.ms/vscode-docker-python | |
FROM python:3.8-slim-buster | |
EXPOSE 5000 | |
ENV VAR1=10 | |
# Keeps Python from generating .pyc files in the container | |
ENV PYTHONDONTWRITEBYTECODE=1 | |
# Turns off buffering for easier container logging | |
ENV PYTHONUNBUFFERED=1 | |
# Install & use pipenv | |
COPY Pipfile Pipfile.lock ./ | |
RUN python -m pip install --upgrade pip | |
RUN pip install pipenv && pipenv install --dev --system --deploy | |
WORKDIR /app | |
COPY . /app | |
# Switching to a non-root user, please refer to https://aka.ms/vscode-docker-python-user-rights | |
RUN useradd appuser && chown -R appuser /app | |
USER appuser | |
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug | |
CMD ["/usr/local/bin/gunicorn", "--bind", "0.0.0.0:5000", "app:app"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment