forked from mirrors/bookwyrm
Dockerize app
This commit is contained in:
parent
eac8f2a2f9
commit
6aad1c9250
4 changed files with 46 additions and 25 deletions
19
.env.example
19
.env.example
|
@ -1,18 +1,23 @@
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
export SECRET_KEY="7(2w1sedok=aznpq)ta1mc4i%4h=xx@hxwx*o57ctsuml0x%fr"
|
SECRET_KEY="7(2w1sedok=aznpq)ta1mc4i%4h=xx@hxwx*o57ctsuml0x%fr"
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
export DEBUG=true
|
DEBUG=true
|
||||||
|
|
||||||
export DOMAIN=your.domain.here
|
DOMAIN=your.domain.here
|
||||||
|
|
||||||
## Leave unset to allow all hosts
|
## Leave unset to allow all hosts
|
||||||
# export ALLOWED_HOSTS="localhost,127.0.0.1,[::1]"
|
# ALLOWED_HOSTS="localhost,127.0.0.1,[::1]"
|
||||||
|
|
||||||
export OL_URL="https://openlibrary.org"
|
OL_URL="https://openlibrary.org"
|
||||||
|
|
||||||
## Database backend to use.
|
## Database backend to use.
|
||||||
## Default is postgres, sqlite is for dev quickstart only (NOT production!!!)
|
## Default is postgres, sqlite is for dev quickstart only (NOT production!!!)
|
||||||
export FEDIREADS_DATABASE_BACKEND=postgres
|
FEDIREADS_DATABASE_BACKEND=postgres
|
||||||
|
|
||||||
|
MEDIA_ROOT="images/"
|
||||||
|
|
||||||
|
POSTGRES_PASSWORD="fedireads"
|
||||||
|
POSTGRES_USER="postgres"
|
||||||
|
POSTGRES_DB="postgres"
|
||||||
|
|
||||||
export MEDIA_ROOT="images/"
|
|
7
Dockerfile
Normal file
7
Dockerfile
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
FROM python:3
|
||||||
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
RUN mkdir /code
|
||||||
|
WORKDIR /code
|
||||||
|
COPY requirements.txt /code/
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
COPY ./fedireads /code
|
19
docker-compose.yml
Normal file
19
docker-compose.yml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres
|
||||||
|
env_file: .env
|
||||||
|
volumes:
|
||||||
|
- pgdata:/var/lib/posgresql/data
|
||||||
|
web:
|
||||||
|
build: .
|
||||||
|
command: python manage.py runserver 0.0.0.0:8000
|
||||||
|
volumes:
|
||||||
|
- .:/code
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
volumes:
|
||||||
|
pgdata:
|
|
@ -70,25 +70,15 @@ WSGI_APPLICATION = 'fedireads.wsgi.application'
|
||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
|
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
|
||||||
|
|
||||||
FEDIREADS_DATABASE_BACKEND = env('FEDIREADS_DATABASE_BACKEND', 'postgres')
|
|
||||||
|
|
||||||
FEDIREADS_DBS = {
|
|
||||||
'postgres': {
|
|
||||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
||||||
'NAME': 'fedireads',
|
|
||||||
'USER': 'fedireads',
|
|
||||||
'PASSWORD': 'fedireads',
|
|
||||||
'HOST': '',
|
|
||||||
'PORT': 5432
|
|
||||||
},
|
|
||||||
'sqlite': {
|
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
|
||||||
'NAME': os.path.join(BASE_DIR, 'fedireads.db')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': FEDIREADS_DBS[FEDIREADS_DATABASE_BACKEND]
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
|
'NAME': 'postgres',
|
||||||
|
'USER': 'postgres',
|
||||||
|
'PASSWORD': '"%s"' % env('POSTGRES_PASSWORD', 'fedireads'),
|
||||||
|
'HOST': 'db',
|
||||||
|
'PORT': 5432
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGIN_URL = '/login/'
|
LOGIN_URL = '/login/'
|
||||||
|
|
Loading…
Reference in a new issue