Everything docker related is now available in its own subfolder

This commit is contained in:
MartenBE
2020-07-30 20:49:42 +02:00
parent ec9b558632
commit e1f1c50809
6 changed files with 13 additions and 23 deletions

27
docker/Dockerfile vendored Normal file
View File

@@ -0,0 +1,27 @@
FROM ubuntu
EXPOSE 8000
RUN apt-get update -y
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential python3 python3-dev python3-pip python3-venv nginx-full
COPY . /pyshelf
WORKDIR /pyshelf/
RUN python3 -m pip install -r requirements.txt
# COPY ../uwsgi_params /etc/nginx/uwsgi_params
COPY ./docker/pyshelf_nginx.conf /etc/nginx/sites-available/pyshelf_nginx.conf
RUN ln -s /etc/nginx/sites-available/pyshelf_nginx.conf /etc/nginx/sites-enabled/
WORKDIR /pyshelf/
ENTRYPOINT cd src/ \
&& python3 manage.py makemigrations \
&& python3 manage.py makemigrations interface \
&& python3 manage.py migrate \
&& python3 manage.py migrate interface \
&& cd .. \
&& python3 importBooks \
&& python3 makeCollections \
&& nginx -g "daemon on;" \
&& uwsgi --ini uwsgi.ini

6
docker/README.md vendored Normal file
View File

@@ -0,0 +1,6 @@
Use `docker-compose -f .\docker\docker-compose.yml up --build` in the project root.
Make sure the following files are in sync:
* config.json
* pyshelf_nginx.conf
* docker-compose.yml
* uwsgi.ini

25
docker/docker-compose.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
version: "3.7"
services:
db:
image: "postgres"
environment:
- "POSTGRES_PASSWORD=pyshelf"
- "POSTGRES_USER=pyshelf"
- "POSTGRES_DB=pyshelf"
volumes:
- "pgdata:/var/lib/postgresql/data/"
pyshelf:
build:
context: ..
dockerfile: ./docker/Dockerfile
ports:
- "8080:8000"
volumes:
- "../books:/books"
depends_on:
- db
volumes:
pgdata:

30
docker/pyshelf_nginx.conf vendored Normal file
View File

@@ -0,0 +1,30 @@
upstream django {
server unix:///tmp/pyshelf_wsgi.sock;
}
server {
listen 8000;
server_name localhost;
access_log /var/log/nginx/pyshelf.access.log;
error_log /var/log/nginx/pyshelf.error.log;
charset utf-8;
client_max_body_size 75M;
location /media {
root /pyshelf/src/interface;
}
location /static {
root /pyshelf/src/interface;
}
location /books {
internal;
alias /pyshelf;
}
location / {
uwsgi_pass django;
include uwsgi_params;
}
}