Created
September 17, 2019 19:04
-
-
Save robsonsilv4/0523b1fb3e1f38f3682f1260c4260199 to your computer and use it in GitHub Desktop.
Django Docker
This file contains hidden or 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.7' | |
services: | |
db: | |
image: postgres:11-alpine | |
volumes: | |
- postgres_data:/var/lib/postgresql/data/ | |
web: | |
build: . | |
command: python /code/manage.py runserver 0.0.0.0:8000 | |
volumes: | |
- .:/code | |
ports: | |
- 8000:8000 | |
depends_on: | |
- db | |
volumes: | |
postgres_data: |
This file contains hidden or 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-slim | |
ENV PYTHONDONTWRITEBYTECODE 1 | |
ENV PYTHONUNBUFFERED 1 | |
WORKDIR /code | |
RUN pip install pipenv | |
COPY Pipfile Pipfile.lock /code/ | |
RUN pipenv install --system | |
COPY . /code/ |
This file contains hidden or 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
# psycopg2-binary | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.postgresql', | |
'NAME': 'postgres', | |
'USER': 'postgres', | |
'HOST': 'db', | |
'PORT': 5432 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment