Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker #474

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
22 changes: 22 additions & 0 deletions backend/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM python:3.11.4-alpine3.18 as requirements

RUN pip install poetry-plugin-export

WORKDIR /code

COPY pyproject.toml poetry.lock ./

RUN poetry export --without-hashes --format=requirements.txt > requirements.txt


FROM python:3.11.4-alpine3.18

RUN apk add --no-cache gettext libintl

WORKDIR /code

COPY --from=requirements /code/requirements.txt .

RUN pip install -r requirements.txt --no-cache-dir

COPY . .
6 changes: 3 additions & 3 deletions development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ services:
nginx:
<<: *common-keys-selab
container_name: nginx
image: nginx:latest
image: nginx:alpine-slim
ports:
- 80:80
- 443:443
Expand All @@ -52,7 +52,7 @@ services:
container_name: backend
build:
context: $BACKEND_DIR
dockerfile: Dockerfile
dockerfile: Dockerfile.dev
command: sh -c "./setup.sh; python manage.py runsslserver 0.0.0.0:8000"
volumes:
- ${BACKEND_DIR}:/code
Expand All @@ -63,7 +63,7 @@ services:
container_name: celery
build:
context: $BACKEND_DIR
dockerfile: Dockerfile
dockerfile: Dockerfile.dev
command: sh -c "./setup.sh && celery -A ypovoli worker -l DEBUG"
volumes:
- ${BACKEND_DIR}:/code
Expand Down
9 changes: 5 additions & 4 deletions production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ x-common-keys-selab: &common-keys-selab
services:
nginx:
<<: *common-keys-selab
image: nginx:latest
image: nginx:alpine-slim
container_name: nginx_prod
ports:
- 80:80
Expand Down Expand Up @@ -62,7 +62,7 @@ services:
container_name: backend_prod
build:
context: $BACKEND_DIR
dockerfile: Dockerfile
dockerfile: Dockerfile.prod
command: sh -c "./setup.sh && gunicorn --config gunicorn_config.py ypovoli.wsgi:application"
depends_on:
- postgres
Expand All @@ -80,10 +80,11 @@ services:
container_name: celery_prod
build:
context: $BACKEND_DIR
dockerfile: Dockerfile
dockerfile: Dockerfile.prod
command: celery -A ypovoli worker -l ERROR
volumes:
- ${BACKEND_DIR}:/code
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/overlay2:/var/lib/docker/overlay2
depends_on:
- backend
- redis
Expand Down
6 changes: 3 additions & 3 deletions test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ x-common-keys-selab_test: &common-keys-selab_test
services:
nginx:
<<: *common-keys-selab_test
image: nginx:latest
image: nginx:alpine-slim
container_name: nginx
volumes:
- ${DATA_DIR}/nginx/nginx.test.conf:/etc/nginx/nginx.conf:ro
Expand All @@ -48,7 +48,7 @@ services:
container_name: backend
build:
context: $BACKEND_DIR
dockerfile: Dockerfile
dockerfile: Dockerfile.dev
command: sh -c "./setup.sh && python manage.py runsslserver 0.0.0.0:8000"
volumes:
- $BACKEND_DIR:/code
Expand All @@ -60,7 +60,7 @@ services:
container_name: celery
build:
context: $BACKEND_DIR
dockerfile: Dockerfile
dockerfile: Dockerfile.dev
command: sh -c "./setup.sh && celery -A ypovoli worker -l DEBUG"
volumes:
- $BACKEND_DIR:/code
Expand Down
Loading