WIP: Docker updates #13

Draft
mravi wants to merge 19 commits from docker into master
2 changed files with 30 additions and 22 deletions
Showing only changes of commit 50e47d5961 - Show all commits

View file

@ -1,38 +1,42 @@
version: '3.8' version: '3'
services: services:
# Django app service
web: web:
build: build:
context: ./ context: .
dockerfile: Dockerfile dockerfile: Dockerfile
command: gunicorn dynamicweb.wsgi:application --bind [::]:8000 container_name: dynamicweb
command: python manage.py runserver 0.0.0.0:8000
volumes: volumes:
- static_volume:/data/app/app/static - .:/app
- media_volume:/data/app/app/media ports:
expose: - "8000:8000"
- 8000
env_file:
- ./.env
depends_on: depends_on:
- db - db
# PostgreSQL database service
db: db:
image: postgres:13.0-alpine image: postgres:13
container_name: my_postgres_db
environment:
POSTGRES_USER: your_postgres_username
POSTGRES_PASSWORD: your_postgres_password
POSTGRES_DB: your_database_name
volumes: volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql - postgres_data:/var/lib/postgresql/data
- postgres_data:/data/var/lib/postgresql/data/
env_file: # Nginx service
- ./.env
nginx: nginx:
build: ./nginx image: nginx:latest
container_name: my_nginx_server
volumes: volumes:
- static_volume:/data/app/app/static - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
- media_volume:/data/app/app/media
ports: ports:
- 1337:80 - "80:80"
depends_on: depends_on:
- web - web
volumes: volumes:
postgres_data: postgres_data:
static_volume:
media_volume:

View file

@ -239,8 +239,12 @@ CMS_TEMPLATES = (
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.db.backends.postgresql',
'NAME': 'app', 'NAME': 'your_database_name',
'USER': 'your_postgres_username',
'PASSWORD': 'your_postgres_password',
'HOST': 'db',
'PORT': '5432'
} }
} }