Last active
October 30, 2017 21:48
-
-
Save urlsangel/68c74ad49a00d78c64c267b5cd20711e to your computer and use it in GitHub Desktop.
Run python with docker-compose
This file contains 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.6.2 | |
RUN mkdir -p /usr/src/app | |
WORKDIR /usr/src/app | |
COPY requirements.txt /usr/src/app/ | |
RUN pip install --no-cache-dir -r requirements.txt | |
ENV PYTHONUNBUFFERED 1 | |
ENV PYTHONDONTWRITEBYTECODE 1 | |
ENV LANG en_US.UTF-8 | |
ENV PYTHONIOENCODING utf_8 |
This file contains 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
web: | |
# assumes your docker-compose.yml is in the root of your project | |
build: . | |
# add a docker file for your python image and requirements | |
dockerfile: .dockerfile | |
# optional startup command, the line below starts a local Django server | |
command: python manage.py runserver 0.0.0.0:80 | |
volumes: | |
# link your source files | |
- ./:/usr/src/app | |
ports: | |
# expose web port | |
- "80:80" | |
environment: | |
# add any environment vars you need | |
# - DEBUG=True |
This file contains 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
## add your pip requirements here to be built into the container |
Author
urlsangel
commented
Oct 30, 2017
- Add the gist files to the root of your project
- Run docker-compose build
- Run docker-compose up
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment