Skip to content

Instantly share code, notes, and snippets.

@nbertagnolli
Created June 28, 2021 00:03
Show Gist options
  • Save nbertagnolli/192ac0aaf801640bdf8af7da4ea7c95a to your computer and use it in GitHub Desktop.
Save nbertagnolli/192ac0aaf801640bdf8af7da4ea7c95a to your computer and use it in GitHub Desktop.
FROM python:3.8
# Setup the api directory for your project code
RUN mkdir /api
COPY . /api
COPY requirements.txt /api
WORKDIR /api
# Install all necessary libraries into a pyenv environment
RUN python3 -m venv /api.venv
RUN . /api.venv/bin/activate && pip install -r requirements.txt
# Expose our access port
EXPOSE 8000
# Run the server in our pyenv environment
CMD . /api.venv/bin/activate && exec uvicorn server:app --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