Last active
March 2, 2021 06:39
-
-
Save dguaraglia/55e9b67c2c0e1f94cc6b7975819ef49b to your computer and use it in GitHub Desktop.
This file contains 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.4" | |
services: | |
postgres: | |
user: "${UID}:${GID}" | |
image: postgres:9.6.18-alpine | |
expose: | |
- "5432" | |
ports: | |
- "5432:5432" | |
volumes: | |
- .development_db:/db | |
environment: | |
POSTGRES_PASSWORD: password | |
POSTGRES_USER: user | |
POSTGRES_DB: dbname | |
PGDATA: /db | |
redis: | |
image: "redis:alpine" | |
ports: | |
- "6379" | |
web: | |
restart: on-failure | |
user: "${UID}:${GID}" | |
build: | |
context: . | |
target: development | |
environment: | |
DATABASE_URL: "postgresql://user:password@postgres:5432/dbname" | |
REDIS_CACHE_LOCATION: "redis://redis:6379/1" | |
volumes: | |
- .:/app | |
ports: | |
- "8000:8000" | |
depends_on: | |
- postgres | |
- redis |
This file contains 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
# Runtime images | |
FROM python:3.8.8-slim as runtime | |
EXPOSE 8000 | |
COPY . /app/ | |
RUN mkdir -p /app/static/js | |
WORKDIR /app | |
RUN pip install -r requirements.txt | |
RUN python manage.py collectstatic --no-input --no-color | |
CMD gunicorn crohn.wsgi:application -w 2 -b :8000 | |
FROM runtime as development | |
CMD 'bash -c "pip install -r requirements.txt && python manage.py migrate && python manage.py collectstatic --no-input && python manage.py runserver 0.0.0.0:8000"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah, forgot to add the command to run it:
The reason I'm specifying the UID and GID is so that the containerized processes don't end up littering the directory with files created by
root
which then become a pain to clean up.