mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
build: add docker-compose deployment
This commit is contained in:
16
.dockerignore
Normal file
16
.dockerignore
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
.dbbackup/
|
||||||
|
.idea/
|
||||||
|
.mypy_cache/
|
||||||
|
.vagrant/
|
||||||
|
.venv/
|
||||||
|
venv/
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
Caddyfile
|
||||||
|
docker-compose.yml
|
||||||
|
mail.log/
|
||||||
|
/roles/
|
||||||
|
/static/
|
||||||
|
*.sqlite3*
|
||||||
|
*.log*
|
||||||
|
deployment*
|
||||||
18
Caddyfile
Normal file
18
Caddyfile
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
localhost breccia-mapper-dev breccia-mapper-dev.jagraham.co.uk mapper.gcrf-breccia.com {
|
||||||
|
|
||||||
|
tls internal
|
||||||
|
|
||||||
|
root * /srv
|
||||||
|
file_server
|
||||||
|
|
||||||
|
@proxy_paths {
|
||||||
|
not path /static/*
|
||||||
|
}
|
||||||
|
|
||||||
|
reverse_proxy @proxy_paths http://web:8000
|
||||||
|
|
||||||
|
log {
|
||||||
|
output stderr
|
||||||
|
format single_field common_log
|
||||||
|
}
|
||||||
|
}
|
||||||
15
Dockerfile
Normal file
15
Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
FROM python:3.8-slim
|
||||||
|
|
||||||
|
RUN groupadd -r mapper && useradd --no-log-init -r -g mapper mapper
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY requirements.txt ./
|
||||||
|
|
||||||
|
RUN pip install --no-cache-dir --upgrade pip \
|
||||||
|
&& pip install --no-cache-dir -r /app/requirements.txt gunicorn
|
||||||
|
|
||||||
|
COPY . ./
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
||||||
|
CMD [ "gunicorn", "-w", "2", "-b", "0.0.0.0:8000", "breccia_mapper.wsgi" ]
|
||||||
33
docker-compose.yml
Normal file
33
docker-compose.yml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
version: '3.1'
|
||||||
|
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- 8000:8000
|
||||||
|
environment:
|
||||||
|
DEBUG: "true"
|
||||||
|
DATABASE_URL: sqlite:////app/db.sqlite3
|
||||||
|
volumes:
|
||||||
|
- ./db.sqlite3:/app/db.sqlite3:z
|
||||||
|
- static_files:/app/static
|
||||||
|
|
||||||
|
caddy:
|
||||||
|
image: caddy:2
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
- 443:443
|
||||||
|
volumes:
|
||||||
|
- ./Caddyfile:/etc/caddy/Caddyfile:z
|
||||||
|
# Caddy serves static files collected by Django
|
||||||
|
- static_files:/srv/static
|
||||||
|
- caddy_data:/data
|
||||||
|
- caddy_config:/config
|
||||||
|
depends_on:
|
||||||
|
- web
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
caddy_data:
|
||||||
|
caddy_config:
|
||||||
|
static_files:
|
||||||
5
entrypoint.sh
Executable file
5
entrypoint.sh
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
python manage.py migrate \
|
||||||
|
&& python manage.py collectstatic --no-input \
|
||||||
|
&& exec "$@"
|
||||||
@@ -21,7 +21,7 @@ isort==4.3.21
|
|||||||
jsonfield==3.1.0
|
jsonfield==3.1.0
|
||||||
lazy-object-proxy==1.4.3
|
lazy-object-proxy==1.4.3
|
||||||
mccabe==0.6.1
|
mccabe==0.6.1
|
||||||
mysqlclient==1.4.6
|
# mysqlclient==1.4.6
|
||||||
pep8-naming==0.4.1
|
pep8-naming==0.4.1
|
||||||
prospector==1.2.0
|
prospector==1.2.0
|
||||||
pycodestyle==2.4.0
|
pycodestyle==2.4.0
|
||||||
|
|||||||
Reference in New Issue
Block a user