Last active
March 11, 2020 18:09
-
-
Save redraw/c32a51a28786750548b8c8f177039ef2 to your computer and use it in GitHub Desktop.
simple django + nginx + gunicorn docker-compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '3' | |
| services: | |
| db: | |
| image: postgres | |
| restart: unless-stopped | |
| web: | |
| build: . | |
| command: gunicorn -b 0.0.0.0:8000 app.wsgi | |
| ports: | |
| - "8000" | |
| depends_on: | |
| - db | |
| environment: | |
| VIRTUAL_HOST: localhost | |
| DJANGO_SETTINGS_MODULE: app.settings.prod | |
| volumes: | |
| - media:/code/media | |
| - static:/code/static | |
| restart: unless-stopped | |
| nginx: | |
| image: jwilder/nginx-proxy | |
| ports: | |
| - "80:80" | |
| depends_on: | |
| - web | |
| volumes: | |
| - static:/var/www/static | |
| - media:/var/www/media | |
| - ./nginx/vhost.d:/etc/nginx/vhost.d:ro | |
| - /var/run/docker.sock:/tmp/docker.sock:ro | |
| restart: unless-stopped | |
| volumes: | |
| static: | |
| media: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3 | |
| ENV PYTHONUNBUFFERED 1 | |
| RUN mkdir /code | |
| WORKDIR /code | |
| COPY requirements.txt /code/ | |
| RUN pip install -r requirements.txt | |
| COPY . /code/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ./nginx/vhost.d/localhost | |
| location /static { | |
| alias /var/www/static; | |
| } | |
| location /media { | |
| alias /var/www/media; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment