This commit is contained in:
relikd
2023-05-29 15:20:07 +02:00
commit 1380b156d8
126 changed files with 3612 additions and 0 deletions

6
docker/app/scripts/run.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
python manage.py collectstatic --noinput
python manage.py migrate
uwsgi --ini /uwsgi.ini

23
docker/app/uwsgi.ini Executable file
View File

@@ -0,0 +1,23 @@
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /django_project
# Django's wsgi file
module = config.wsgi
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 8
# the socket (use the full path to be safe)
socket = :8888
# ... with appropriate permissions - may be needed
# chmod-socket = 664
# clear environment on exit
vacuum = true
# DO NOT USE IN PRODUCTION
# py-autoreload = 2

28
docker/docker-compose.yml Executable file
View File

@@ -0,0 +1,28 @@
version: '3'
services:
web:
container_name: web
build:
context: nginx
dockerfile: Dockerfile
ports:
- 80:80
volumes:
- django-static:/var/www/html/static
working_dir: /etc/nginx
links:
- app
app:
container_name: app
build:
context: ..
dockerfile: Dockerfile
environment:
DJANGO_SECRET_KEY: $DJANGO_SECRET_KEY
ALLOWED_HOSTS: $ALLOWED_HOSTS
volumes:
- django-static:/var/www/html/static
working_dir: /django_project
volumes:
django-static:

2
docker/nginx/Dockerfile Executable file
View File

@@ -0,0 +1,2 @@
FROM nginx:alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf

20
docker/nginx/nginx.conf Executable file
View File

@@ -0,0 +1,20 @@
upstream django {
# server unix:///path/to/your/mysite/mysite.sock;
server app:8888;
}
server {
listen 80;
server_name localhost;
charset utf-8;
# max upload size
client_max_body_size 75M;
location /media { alias /var/www/html/media; }
location /static { alias /var/www/html/static; }
location / {
uwsgi_pass django;
include /etc/nginx/uwsgi_params; # the uwsgi_params file you installed
}
}