Skip to content

Instantly share code, notes, and snippets.

@kevinbowen777
Created April 29, 2022 21:40
Show Gist options
  • Save kevinbowen777/8e6fe30d82d7eb0377cc09f5c4e84604 to your computer and use it in GitHub Desktop.
Save kevinbowen777/8e6fe30d82d7eb0377cc09f5c4e84604 to your computer and use it in GitHub Desktop.

See this StackOverflow answer for additional information.


# Pull base image                                        
FROM python:3.10                                         
                                                         
# Set environment variables                             
ENV PYTHONDONTWRITEBYTECODE 1                            
ENV PYTHONUNBUFFERED 1                                   
ENV PIP_NO_CACHE_DIR=off                                 
ENV PIP_DISABLE_VERSION_CHECK=on                         
                                                         
# System dependencies:                                   
RUN pip install poetry                                   
                                                         
# Copy only requirements to cache them in docker layer   
WORKDIR /code                                            
COPY pyproject.toml poetry.lock /code/                   
                                                         
# Project initialization:                                
RUN poetry config virtualenvs.create false               
RUN poetry install                                       
                                                         
# Creating folders and files for project:                
COPY . /code/ 
@kevinbowen777
Copy link
Author

See this Django/Docker template for a more in-depth Docker container build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment