mirror of
https://github.com/ajurna/cbwebreader.git
synced 2025-12-06 06:17:17 +00:00
Adding docker files
This commit is contained in:
10
.dockerignore
Normal file
10
.dockerignore
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Dockerignore whitelist
|
||||||
|
*
|
||||||
|
|
||||||
|
!Pipfile
|
||||||
|
!Pipfile.lock
|
||||||
|
!cbreader
|
||||||
|
!comic
|
||||||
|
!comic_auth
|
||||||
|
!manage.py
|
||||||
|
!pytest
|
||||||
26
Dockerfile
26
Dockerfile
@@ -1,16 +1,28 @@
|
|||||||
FROM python:3-alpine
|
FROM python:3-alpine
|
||||||
|
|
||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
RUN apk update
|
RUN apk update
|
||||||
RUN apk add --no-cache tini bash unrar dcron postgresql-dev
|
RUN apk add --no-cache tini bash unrar dcron postgresql-dev gcc python3-dev musl-dev
|
||||||
RUN mkdir /src
|
|
||||||
WORKDIR /src
|
|
||||||
ADD Pipfile /src
|
|
||||||
ADD Pipfile.lock /src
|
|
||||||
RUN apk add --no-cache --virtual .build-deps mariadb-dev build-base \
|
RUN apk add --no-cache --virtual .build-deps mariadb-dev build-base \
|
||||||
&& pip install pipenv \
|
&& pip install pipenv \
|
||||||
&& pipenv install --system \
|
|
||||||
&& apk add --virtual .runtime-deps mariadb-connector-c-dev mariadb-connector-c \
|
&& apk add --virtual .runtime-deps mariadb-connector-c-dev mariadb-connector-c \
|
||||||
&& apk del .build-deps
|
&& apk del .build-deps
|
||||||
ADD . /src/
|
|
||||||
|
RUN mkdir /src
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
ADD Pipfile /src
|
||||||
|
ADD Pipfile.lock /src
|
||||||
|
|
||||||
|
RUN pipenv install --deploy --dev --ignore-pipfile --system
|
||||||
|
|
||||||
|
COPY . /src/
|
||||||
|
|
||||||
RUN cat /src/cbreader/crontab >> /etc/crontabs/root
|
RUN cat /src/cbreader/crontab >> /etc/crontabs/root
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ https://docs.djangoproject.com/en/1.8/ref/settings/
|
|||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import dj_database_url
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
|
|
||||||
@@ -76,12 +78,17 @@ WSGI_APPLICATION = 'cbreader.wsgi.application'
|
|||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
|
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
|
||||||
|
|
||||||
DATABASES = {
|
DATABASE_URL = os.getenv("DATABASE_URL")
|
||||||
'default': {
|
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
if DATABASE_URL:
|
||||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
DATABASES = {"default": dj_database_url.config(conn_max_age=500)}
|
||||||
|
else:
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Internationalization
|
# Internationalization
|
||||||
|
|||||||
37
docker-compose.yml
Normal file
37
docker-compose.yml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
app:
|
||||||
|
build: .
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://admin:password@database:5432/cbwebreader
|
||||||
|
- DJANGO_SETTINGS_MODULE=cbreader.settings
|
||||||
|
links:
|
||||||
|
- database
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
volumes:
|
||||||
|
- ./cbreader:/src/cbreader
|
||||||
|
- ./comic:/src/comic
|
||||||
|
- ./comic_auth:/src/comic_auth
|
||||||
|
- D:\Downloads\comics:/data
|
||||||
|
command: python manage.py runserver 0.0.0.0:8000
|
||||||
|
|
||||||
|
database:
|
||||||
|
image: postgres:11.4-alpine
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
volumes:
|
||||||
|
- /var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=admin
|
||||||
|
- POSTGRES_PASSWORD=password
|
||||||
|
- POSTGRES_DB=cbwebreader
|
||||||
|
|
||||||
|
# volumes:
|
||||||
|
# comic-volume:
|
||||||
|
# name: comic-volume
|
||||||
|
# external: true
|
||||||
Reference in New Issue
Block a user