diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..5d059d6 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3.10-slim +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +RUN mkdir -p /app/data \ + && chmod +x /app/entrypoint.sh + +EXPOSE 8143 + +ENTRYPOINT ["./entrypoint.sh"] diff --git a/backend/entrypoint.sh b/backend/entrypoint.sh new file mode 100644 index 0000000..0971e28 --- /dev/null +++ b/backend/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +if [ -z "$(ls -A /app/alembic/versions)" ]; then + alembic revision --autogenerate -m "Initial migration" +fi + +alembic upgrade head +exec uvicorn app.main:app --host 0.0.0.0 --port 8143 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4ee8276 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,31 @@ +services: + backend: + build: + context: ./backend + dockerfile: Dockerfile + container_name: govorov-backend + restart: unless-stopped + env_file: + - ./backend/.env + environment: + - DATABASE_URL=sqlite:///./data/glass_cutting.db + volumes: + - glass_db:/app/data + ports: + - "8143:8143" + + frontend: + build: + context: ./frontend + dockerfile: Dockerfile + container_name: govorov-frontend + environment: + - VITE_API_URL:https://govorov.itqop.pw/api + depends_on: + - backend + restart: unless-stopped + ports: + - "4173:4173" + +volumes: + glass_db: diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..88ee4e9 --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,8 @@ +FROM node:23.11.0-alpine +WORKDIR /app +COPY package*.json ./ +RUN npm ci +COPY . . +RUN npm run build +EXPOSE 4173 +CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "4173"]