diff --git a/infra/dev/docker-compose.dev.yaml b/infra/dev/docker-compose.dev.yaml new file mode 100644 index 00000000..483fd6ee --- /dev/null +++ b/infra/dev/docker-compose.dev.yaml @@ -0,0 +1,17 @@ +version: '3.8' +name: ahf_dev + +services: + db: + container_name: db + image: postgres:13.0-alpine + restart: always + volumes: + - postgres_data:/var/lib/postgresql/data/ + env_file: + - ../../.env + ports: + - 5432:5432 + +volumes: + postgres_data: diff --git a/infra/prod/Dockerfile b/infra/prod/Dockerfile new file mode 100644 index 00000000..57f048ff --- /dev/null +++ b/infra/prod/Dockerfile @@ -0,0 +1,18 @@ +FROM python:3.11-slim-bullseye AS builder + +WORKDIR /app +COPY poetry.lock pyproject.toml ./ + +RUN python -m pip install --no-cache-dir poetry==1.6.1 \ + && poetry config virtualenvs.in-project true \ + && poetry install --without dev --with test + +FROM python:3.11-slim-bullseye + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +COPY --from=builder /app /app +COPY adaptive_hockey_federation/ ./ +ENTRYPOINT ["/entrypoint.sh"] + +CMD ["/app/.venv/bin/gunicorn", "adaptive_hockey_federation.wsgi:application", "--bind", "0:8000" ] diff --git a/infra/prod/docker-compose.prod.yaml b/infra/prod/docker-compose.prod.yaml new file mode 100644 index 00000000..3b1bc675 --- /dev/null +++ b/infra/prod/docker-compose.prod.yaml @@ -0,0 +1,39 @@ +version: '3.8' +name: ahf_prod + +services: + db: + container_name: db + image: postgres:13.0-alpine + restart: always + volumes: + - postgres_data:/var/lib/postgresql/data/ + env_file: + - ./.env + + site: + image: imageName + restart: always + volumes: + - static_value:/app/static/ + - media_value:/app/media/ + env_file: + - ./.env + depends_on: + - db + + nginx: + image: nginx:1.21.3-alpine + ports: + - "80:80" + volumes: + - ../../nginx/default.conf:/etc/nginx/conf.d/default.conf + - static_value:/var/html/static/ + - media_value:/var/html/media/ + depends_on: + - site + +volumes: + static_value: + media_value: + postgres_data: diff --git a/infra/stage/Dockerfile b/infra/stage/Dockerfile new file mode 100644 index 00000000..57f048ff --- /dev/null +++ b/infra/stage/Dockerfile @@ -0,0 +1,18 @@ +FROM python:3.11-slim-bullseye AS builder + +WORKDIR /app +COPY poetry.lock pyproject.toml ./ + +RUN python -m pip install --no-cache-dir poetry==1.6.1 \ + && poetry config virtualenvs.in-project true \ + && poetry install --without dev --with test + +FROM python:3.11-slim-bullseye + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +COPY --from=builder /app /app +COPY adaptive_hockey_federation/ ./ +ENTRYPOINT ["/entrypoint.sh"] + +CMD ["/app/.venv/bin/gunicorn", "adaptive_hockey_federation.wsgi:application", "--bind", "0:8000" ] diff --git a/infra/stage/docker-compose.stage.yaml b/infra/stage/docker-compose.stage.yaml new file mode 100644 index 00000000..f6a45f9d --- /dev/null +++ b/infra/stage/docker-compose.stage.yaml @@ -0,0 +1,39 @@ +version: '3.8' +name: ahf_stage + +services: + db: + container_name: db + image: postgres:13.0-alpine + restart: always + volumes: + - postgres_data:/var/lib/postgresql/data/ + env_file: + - ./.env + + site: + image: imageName + restart: always + volumes: + - static_value:/app/static/ + - media_value:/app/media/ + env_file: + - ./.env + depends_on: + - db + + nginx: + image: nginx:1.21.3-alpine + ports: + - "80:80" + volumes: + - ../../nginx/default.conf:/etc/nginx/conf.d/default.conf + - static_value:/var/html/static/ + - media_value:/var/html/media/ + depends_on: + - site + +volumes: + static_value: + media_value: + postgres_data: