Created
May 14, 2019 13:56
-
-
Save marcelobbfonseca/4b7a2f4a083aea29c2bfa1b27e52cb36 to your computer and use it in GitHub Desktop.
Dockerfile and docker-compose development example configuration for python Django+postgresql environment. Application runs on port 3000
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
version: '3' | |
services: | |
db: | |
image: postgres | |
environment: | |
POSTGRES_USER: postgres | |
POSTGRES_DB: database_dev | |
POSTGRES_PASSWORD: secret | |
PGPASSWORD: secret | |
ports: | |
- "5432:5432" | |
volumes: | |
- ./project-dump/:/var/www/html # Optional .sql database dump file. | |
- ./postgres-database:/var/lib/postgresql/data # Save container database data to your machine. | |
web: | |
build: . | |
command: python3 manage.py runserver 0.0.0.0:3000 | |
volumes: | |
- .:/code # for development only | |
ports: | |
- "3000:3000" | |
depends_on: | |
- db | |
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.7.3-stretch | |
ENV PYTHONUNBUFFERED 1 | |
RUN mkdir /code | |
WORKDIR /code | |
COPY requirements.txt /code/ | |
RUN pip install -r requirements.txt | |
COPY . /code/ | |
EXPOSE 3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment