update to Dockerfile to make the build much smaller.

This commit is contained in:
2021-05-05 21:27:36 +01:00
parent 1bb272e07f
commit 443e43e3f0
4 changed files with 117 additions and 41 deletions

35
compose/.env.docker Normal file
View File

@@ -0,0 +1,35 @@
# Set this or it won't work.
DJANGO_SECRET_KEY=
DJANGO_DEBUG=False
#set this to the hostname of your server.
DJANGO_ALLOWED_HOSTS=localhost
DB_USER=admin
# Please set a better password
DB_PASS=password
DB_HOST=database
DB_DATABASE=cbwebreader
# https://github.com/jacobian/dj-database-url
DATABASE_URL=postgres://${DB_USER}:${DB_PASS}@${DB_HOST}/${DB_DATABASE}
#Path to your comics.
COMIC_BOOK_VOLUME=/media/plex/comics
STATIC_ROOT='/static'
MEDIA_ROOT='/media'
# This expects the office winrar unrar command line tool for windows or linux.
# Will work without setting if it is in the path
# UNRAR_TOOL = 'unrar.exe'
# for google recaptcha 2
# DJANGO_CBREADER_USE_RECAPTCHA = True
# DJANGO_RECAPTCHA_PRIVATE_KEY = ''
# DJANGO_RECAPTCHA_PUBLIC_KEY = ''
# Comment the following if not using a reverse proxy.
USE_X_FORWARDED_HOST=True

View File

@@ -0,0 +1,57 @@
version: "3.7"
services:
cbwebreader:
image: ajurna/cbwebreader
env_file: .env
links:
- database
depends_on:
- database
expose:
- 8000
volumes:
- ${COMIC_BOOK_VOLUME}:${COMIC_BOOK_VOLUME}
- static_files:/static
- media_files:/media
- .env:/src/.env
command: /bin/bash entrypoint.sh
cbwebreader-cron:
image: ajurna/cbwebreader
env_file: .env
links:
- database
depends_on:
- database
volumes:
- ${COMIC_BOOK_VOLUME}:${COMIC_BOOK_VOLUME}
- media_files:/media
- .env:/src/.env
command: /bin/bash entrypoint-cron.sh
database:
image: postgres:11.4-alpine
expose:
- 5432
volumes:
- ./data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASS}
- POSTGRES_DB=${DB_DATABASE}
nginx:
image: nginx
volumes:
- static_files:/static
- media_files:/media
- ./nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- 1337:80
depends_on:
- cbwebreader
volumes:
static_files:
media_files:

23
compose/nginx.conf Normal file
View File

@@ -0,0 +1,23 @@
upstream cbwebreader_django {
server cbwebreader:8000;
}
server {
listen 80;
location / {
proxy_pass http://cbwebreader_django;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}
location /static/ {
alias /static/;
}
location /media/ {
alias /media/;
}
}