diff --git a/Dockerfile b/Dockerfile index 49e4dc5b24785dfd11eb645b39428121b6ff64fb..af627e6902d37a6717cb9d034fc11267d269746c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM python:3.8-buster -65;5402;1c + ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE 1 ENV PIP_DEFAULT_TIMEOUT=100 diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4872fa4f4bf527ebbafd10f1fc61d43118b3b48d --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,46 @@ +version: '3' + +services: + db: + image: postgres:latest + volumes: + - postgres_data:/var/lib/postgresql/data/ + environment: + - POSTGRES_USER=biscuit + - POSTGRES_PASSWORD=biscuit + - POSTGRES_DB=biscuit + memcached: + image: memcached:latest + app: + build: . + volumes: + - biscuit_media:/srv/media + - biscuit_static:/srv/static + - biscuit_backups:/var/backups/biscuit + - javascript:/usr/share/javascript + environment: + - BISCUIT_secret_key=DoNotUseInProduction + - BISCUIT_http.allowed_hosts="['*']" + - BISCUIT_database.host=db + - BISCUIT_database.password=biscuit + - BISCUIT_caching.memcached.address=memcached:11211 + depends_on: + - db + - memcached + web: + build: ./docker/nginx + volumes: + - biscuit_media:/srv/media + - biscuit_static:/srv/static + - javascript:/srv/javascript + ports: + - 8080:80 + depends_on: + - app + +volumes: + postgres_data: + biscuit_media: + biscuit_static: + biscuit_backups: + javascript: diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..6aa2a745d106bae0e5c364f0739a2ff6b1f0d38a --- /dev/null +++ b/docker/nginx/Dockerfile @@ -0,0 +1,8 @@ +FROM nginx + +RUN rm /etc/nginx/conf.d/default.conf +COPY nginx.conf /etc/nginx/conf.d + +RUN mkdir /srv/media +RUN mkdir /srv/static +RUN mkdir /srv/javascript diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf new file mode 100644 index 0000000000000000000000000000000000000000..de25fd6f1c4f21b14645df3e353f58e62b991f6f --- /dev/null +++ b/docker/nginx/nginx.conf @@ -0,0 +1,26 @@ +upstream biscuit { + server app:8000; +} + +server { + listen 80; + + location / { + proxy_pass http://biscuit; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $host; + proxy_redirect off; + } + + location /media/ { + alias /srv/media/; + } + + location /static/ { + alias /srv/static/; + } + + location /javascript/ { + alias /srv/javascript/; + } +}