forked from mirrors/bookwyrm
parent
845401bd62
commit
dbabeab470
5 changed files with 48 additions and 11 deletions
|
@ -1,9 +1,10 @@
|
|||
FROM python:3
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
RUN mkdir /app
|
||||
RUN mkdir /app/static
|
||||
RUN mkdir /app/images
|
||||
WORKDIR /app
|
||||
COPY requirements.txt /app/
|
||||
RUN pip install -r requirements.txt
|
||||
COPY ./fedireads /app
|
||||
COPY ./fr_celery /app
|
||||
EXPOSE 5555
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
nginx:
|
||||
build: ./nginx
|
||||
ports:
|
||||
- 1333:80
|
||||
depends_on:
|
||||
- web
|
||||
networks:
|
||||
- main
|
||||
volumes:
|
||||
- static_volume:/app/static
|
||||
- media_volume:/app/images
|
||||
db:
|
||||
image: postgres
|
||||
env_file: .env
|
||||
|
@ -13,13 +24,15 @@ services:
|
|||
command: python manage.py runserver 0.0.0.0:8000
|
||||
volumes:
|
||||
- .:/app
|
||||
ports:
|
||||
- "8000:8000"
|
||||
- static_volume:/app/static
|
||||
- media_volume:/app/images
|
||||
depends_on:
|
||||
- db
|
||||
- celery_worker
|
||||
networks:
|
||||
- main
|
||||
expose:
|
||||
- 8000
|
||||
redis:
|
||||
image: redis
|
||||
env_file: .env
|
||||
|
@ -40,14 +53,9 @@ services:
|
|||
- db
|
||||
- redis
|
||||
restart: on-failure
|
||||
flower:
|
||||
image: mher/flower
|
||||
command: ["flower", "--broker=redis://redis:6379/0", "--port=5555"]
|
||||
env_file: .env
|
||||
ports:
|
||||
- "5555:5555"
|
||||
restart: on-failure
|
||||
volumes:
|
||||
pgdata:
|
||||
static_volume:
|
||||
media_volume:
|
||||
networks:
|
||||
main:
|
||||
|
|
|
@ -138,6 +138,8 @@ USE_TZ = True
|
|||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/2.0/howto/static-files/
|
||||
|
||||
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, env('STATIC_ROOT', 'static'))
|
||||
MEDIA_URL = '/images/'
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, env('MEDIA_ROOT', 'images/'))
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, env('MEDIA_ROOT', 'images'))
|
||||
|
|
4
nginx/Dockerfile
Normal file
4
nginx/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM nginx:1.17.4-alpine
|
||||
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
COPY nginx.conf /etc/nginx/conf.d
|
22
nginx/nginx.conf
Normal file
22
nginx/nginx.conf
Normal file
|
@ -0,0 +1,22 @@
|
|||
upstream web {
|
||||
server web:8000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
proxy_pass http://web;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect off;
|
||||
}
|
||||
|
||||
location /images/ {
|
||||
alias /app/images/;
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
alias /app/static/;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue