mirror of
https://github.com/ajurna/cbwebreader.git
synced 2025-12-06 06:17:17 +00:00
update to Dockerfile to make the build much smaller.
This commit is contained in:
43
README.md
43
README.md
@@ -18,47 +18,8 @@ The primary frameworks and tool's are used within the application:
|
|||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
|
||||||
The CBWebReader is a Django project and follows the standard conventions for a Django application. To get started, clone the project into your workspace:
|
The CBWebReader is a Django project and follows the standard conventions for a Django application. To get started just look in the compose folder and there is an example setup.
|
||||||
|
just rename the .env.docker file to .env and add some config details and it should work right away.
|
||||||
```bash
|
|
||||||
git clone https://github.com/ajurna/cbwebreader
|
|
||||||
```
|
|
||||||
|
|
||||||
Configure the environment using the `.env` file or setting each variable within your environment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp .env.example .env
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternatively, set the path to your `COMIC_BOOK_VOLUME` like so:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export COMIC_BOOK_VOLUME=some_path_to_comics_directory
|
|
||||||
```
|
|
||||||
|
|
||||||
Build and run the project using docker-compose:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker-compose up --build -d
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running Tests
|
|
||||||
|
|
||||||
To run the entire test suite for CBWebReader, execute the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker-compose run app pytest -vvv
|
|
||||||
```
|
|
||||||
|
|
||||||
## Syncing comic books
|
|
||||||
|
|
||||||
Once the application has been configured and runs for the first time, an initial import of comics will be made available to browse and view. However, future additions will need to be synced before they will be available. A sync can be performed by running the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker-compose run app python manage.py scan_comics
|
|
||||||
```
|
|
||||||
|
|
||||||
It is recommended that you configure a scheduled task to run the sync as frequently as you wish to ensure your collection is up-to-date.
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
35
compose/.env.docker
Normal file
35
compose/.env.docker
Normal 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
|
||||||
57
compose/docker-compose.yml
Normal file
57
compose/docker-compose.yml
Normal 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
23
compose/nginx.conf
Normal 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/;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user