Skip to content

Commit

Permalink
Добавляет docker-контейнер для бэкенда
Browse files Browse the repository at this point in the history
  • Loading branch information
codEnjoyer committed Nov 7, 2023
1 parent 742b7aa commit 2c10bea
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
13 changes: 13 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python:3.11.4-slim-bullseye

WORKDIR /fastapi_app/backend

COPY ./backend/requirements.txt /fastapi_app/backend

RUN pip install --no-cache-dir --upgrade pip

RUN pip install --no-cache-dir -r /fastapi_app/backend/requirements.txt

COPY ./backend /fastapi_app/backend

RUN chmod a+x ./*.sh
4 changes: 4 additions & 0 deletions backend/docker-launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
alembic upgrade head
cd src || exit
gunicorn main:app --workers 1 --worker-class uvicorn.workers.UvicornWorker --bind=0.0.0.0:"$BACK_APP_PORT" --timeout 300
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
version: "3.8"
services:
backend:
container_name: fastapi_app
build:
context: .
dockerfile: ./backend/Dockerfile
env_file:
- .env
command: [ "sh", "/fastapi_app/backend/docker-launch.sh" ]
ports:
- "${BACK_APP_PORT}:${BACK_APP_PORT}"
restart: unless-stopped

db:
container_name: db_app
image: postgres:15
Expand Down

0 comments on commit 2c10bea

Please sign in to comment.