Skip to content

Instantly share code, notes, and snippets.

@robsonsilv4
Created September 17, 2019 19:04
Show Gist options
  • Save robsonsilv4/0523b1fb3e1f38f3682f1260c4260199 to your computer and use it in GitHub Desktop.
Save robsonsilv4/0523b1fb3e1f38f3682f1260c4260199 to your computer and use it in GitHub Desktop.
Django Docker
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:
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/
# 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