setup docker image

This commit is contained in:
2024-11-24 17:58:43 +00:00
parent 8429e985df
commit d3a01fe93d
5 changed files with 34 additions and 4 deletions

3
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.venv
__pycache__
db.sqlite3
db.sqlite3
env.*

13
Dockerfile Normal file
View File

@@ -0,0 +1,13 @@
FROM python:3-slim
# set work directory
WORKDIR /usr/src/app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# install dependencies
RUN pip install --upgrade pip
COPY ./requirements.txt .
RUN pip install -r requirements.txt

View File

@@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/5.1/ref/settings/
"""
from pathlib import Path
import os
from django.core.management.commands.runserver import Command as runserver
runserver.default_port = "7100"
@@ -24,12 +25,15 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-snqnsca90!r=^iu6yyhpxy^+mjm%7dvrg(lb!6fr3(!9yh(c30'
# SECRET_KEY = 'django-insecure-snqnsca90!r=^iu6yyhpxy^+mjm%7dvrg(lb!6fr3(!9yh(c30'
SECRET_KEY = os.environ.get("SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# DEBUG = True
DEBUG = bool(os.environ.get("DEBUG", default=0))
ALLOWED_HOSTS = ['192.168.1.146']
# ALLOWED_HOSTS = ['192.168.1.146']
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ")
# Application definition

10
docker-compose.yml Normal file
View File

@@ -0,0 +1,10 @@
services:
web:
build: .
command: gunicorn bartool_ovh.wsgi:application --bind 0.0.0.0:8000
volumes:
- ./app/:/usr/src/app/
ports:
- 8100:8000
env_file:
- ./env.dev

View File

@@ -1,6 +1,8 @@
asgiref==3.8.1
Django==5.1.3
gunicorn==23.0.0
holidays==0.61
packaging==24.2
python-dateutil==2.9.0.post0
six==1.16.0
sqlparse==0.5.2