wip changes

This commit is contained in:
vabene1111 2020-03-24 12:57:45 +01:00
parent e3b71d47f4
commit c67342df26
9 changed files with 81 additions and 8 deletions

View File

@ -1,6 +1,5 @@
FROM python:3.8-alpine
# hadolint ignore=DL3018
RUN apk add --no-cache postgresql-libs gettext zlib libjpeg libxml2-dev libxslt-dev
ENV PYTHONUNBUFFERED 1
EXPOSE 8080
@ -15,7 +14,6 @@ COPY --chown=recipes:recipes . ./
RUN chmod +x boot.sh setup.sh
RUN ln -s /opt/recipes/setup.sh /usr/local/bin/createsuperuser
# hadolint ignore=DL3018
RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev && \
python -m venv venv && \
venv/bin/pip install -r requirements.txt --no-cache-dir &&\

View File

@ -2,5 +2,3 @@ This is a docker compose example when using [jwilder's nginx reverse proxy](http
in combination with [jrcs's letsencrypt companion](https://hub.docker.com/r/jrcs/letsencrypt-nginx-proxy-companion/).
Please refer to the appropriate documentation on how to setup the reverse proxy and networks.
Copy the docker-compose.override.yml.template and uncomment the corresponding part.

View File

@ -0,0 +1,19 @@
version: "3"
services:
nginx_recipes:
image: nginx:mainline-alpine
restart: always
env_file:
- ./.env
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
- ./staticfiles:/static
- ./mediafiles:/media
networks:
- default
- nginx-proxy
networks:
nginx-proxy:
external:
name: nginx-proxy

View File

@ -1 +0,0 @@
Just run docker-compose up in the root of this repository.

View File

@ -0,0 +1,22 @@
version: "3"
services:
db_recipes:
restart: always
image: postgres:11-alpine
volumes:
- ./postgresql:/var/lib/postgresql/data
env_file:
- ./.env
web_recipes:
build: .
restart: always
env_file:
- ./.env
volumes:
- ./staticfiles:/opt/recipes/staticfiles
- ./mediafiles:/opt/recipes/mediafiles
ports:
- 80:8080
depends_on:
- db_recipes

View File

@ -1,7 +1,6 @@
Please refer to the traefik documentation on how to setup a docker service in traefik. Since treafik can be a little
confusing at times, the following are examples of my traefik configuration.
Copy the docker-compose.override.yml.template and uncomment the corresponding part.
You need to create a network called `traefik` using `docker network create traefik`.
## docker-compose.yml

View File

@ -0,0 +1,40 @@
version: "3"
services:
db_recipes:
restart: always
image: "postgres:11-alpine"
volumes:
- ./postgresql:/var/lib/postgresql/data
env_file:
- ./.env
web_recipes:
build: .
restart: always
env_file:
- ./.env
command: "gunicorn --bind 0.0.0.0:8080 recipes.wsgi"
volumes:
- .:/Recipes
depends_on:
- db_recipes
nginx_recipes:
image: "nginx"
restart: always
env_file:
- ./.env
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
- ./staticfiles:/static
- ./mediafiles:/media
labels:
- "traefik.enable=true"
- "traefik.http.routers.recipes.rule=Host(`recipes.mydomain.com`, `recipes.myotherdomain.com`)"
- "traefik.http.routers.recipes.entrypoints=web_secure"
- "traefik.http.routers.recipes.tls.certresolver=le_resolver"
networks:
default:
external:
name: traefik

View File

@ -57,8 +57,6 @@ INSTALLED_APPS = [
]
MIDDLEWARE = [
# Simplified static file serving.
# https://warehouse.python.org/project/whitenoise/
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',