Skip to content

Commit

Permalink
chore: changed production docker (#432) (#433)
Browse files Browse the repository at this point in the history
* chore: changed production docker

* chore: modified tests as well

* chore: celery
  • Loading branch information
Topvennie authored May 16, 2024
1 parent f9353d6 commit b29c598
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 10 deletions.
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

0 comments on commit b29c598

Please sign in to comment.