Skip to content

Instantly share code, notes, and snippets.

@aled1027
Created March 5, 2023 16:05
Show Gist options
  • Save aled1027/3a994d4c0d3b9ac525e9532ceac38f7b to your computer and use it in GitHub Desktop.
Save aled1027/3a994d4c0d3b9ac525e9532ceac38f7b to your computer and use it in GitHub Desktop.
Fly Python Dockerfile
FROM python:3.10
# set work directory
WORKDIR /usr/src/app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
COPY . .
# install dependencies
RUN pip install poetry
RUN poetry config virtualenvs.create false \
&& poetry install
EXPOSE 8000
# This command is good for just getting it running. This will run the server on port 8000
CMD ["poetry", "run", "python", "manage.py", "runserver"]
# or
# CMD ["poetry", "run", "python", "-m", "uvicorn", "config.asgi:application", "--host", "0.0.0.0", "--port", "8000"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment