Skip to content

Commit

Permalink
Starting with docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
reinout committed Mar 12, 2024
1 parent 2fbc381 commit 2a529ac
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 6 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM python:3.12

WORKDIR /code
COPY . .
RUN pip install -r requirements.txt
10 changes: 4 additions & 6 deletions bro_hub/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,12 @@
# Database
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
DATABASES = {
# TODO: use docker-compose's version.
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "bro_hub_dev",
"USER": "postgres",
"PASSWORD": "postgres",
"HOST": "localhost",
"PORT": "5432",
"NAME": "bro_hub",
"USER": "bro_hub",
"PASSWORD": "bro_hub",
"HOST": "db",
}
}

Expand Down
35 changes: 35 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: '2'

services:

db:
image: mdillon/postgis
environment:
POSTGRES_USER: 'bro_hub'
POSTGRES_PASSWORD: 'bro_hub'
POSTGRES_DB: 'bro_hub'
volumes:
- pgdata:/var/lib/postgresql/data
restart: unless-stopped

web:
build: .
# command: "bin/gunicorn -b 0.0.0.0:${PORT:-5000} --workers=3 --timeout 90 --preload --max-requests=10000 trs.wsgi"
command: "python manage.py runserver 0.0.0.0:8000"
ports:
- "8000:8000"
volumes:
- .:/code
restart: unless-stopped
environment:
# # Can be set in .env, we'll pass them on.
# - SECRET_KEY
- DEBUG
- FIELD_ENCRYPTION_KEY
# - SENTRY_DSN
# - NENS_AUTH_ISSUER
# - NENS_AUTH_CLIENT_ID
# - NENS_AUTH_CLIENT_SECRET

volumes:
pgdata:
3 changes: 3 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
"""Run administrative tasks."""
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bro_hub.settings")

try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down

0 comments on commit 2a529ac

Please sign in to comment.