Skip to content

Commit

Permalink
Very basic docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepman4267 committed Mar 9, 2023
1 parent 4e64bba commit dff8a9e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM python:3.11-alpine

RUN apk add bash

COPY requirements.txt requirements.txt

RUN pip install -r requirements.txt

COPY . .

ARG HAT_DEBUG='False'
ARG HAT_STATIC_ROOT='/static-root'
ARG HAT_ALLOWED_HOSTS='0.0.0.0'
ARG HAT_SQLITE3_PATH='/db.sqlite3'


ENV HAT_DEBUG=${HAT_DEBUG}
ENV HAT_SECRET_KEY=${HAT_SECRET_KEY}
ENV HAT_STATIC_ROOT=${HAT_STATIC_ROOT}
ENV HAT_ALLOWED_HOSTS=${HAT_ALLOWED_HOSTS}
ENV HAT_SQLITE3_PATH=${HAT_SQLITE3_PATH}

EXPOSE 8000/

ENTRYPOINT python manage.py migrate \
&& python manage.py collectstatic --no-input \
&& honcho start
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: python -m gunicorn agenda_hat.asgi:application -k uvicorn.workers.UvicornWorker
12 changes: 8 additions & 4 deletions agenda_hat/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

from pathlib import Path

import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

Expand All @@ -20,13 +22,15 @@
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-4=nvn+3!^^#3489hot0brrx-!m+efx_^+x@^mwq^)c-$#u^^_m'

# SECRET_KEY = 'django-insecure-4=nvn+3!^^#3489hot0brrx-!m+efx_^+x@^mwq^)c-$#u^^_m'
SECRET_KEY = os.environ['HAT_SECRET_KEY']
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = {'False': False, 'True': True}[os.environ['HAT_DEBUG']]

ALLOWED_HOSTS = []
ALLOWED_HOSTS = os.environ['HAT_ALLOWED_HOSTS'].split(',')
CSRF_TRUSTED_ORIGINS = ['https://'+host for host in ALLOWED_HOSTS]

STATIC_ROOT = Path(os.environ['HAT_STATIC_ROOT'])

# Application definition

Expand Down
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
django
honcho
uvicorn
gunicorn

0 comments on commit dff8a9e

Please sign in to comment.