run with docker compose
This commit is contained in:
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
FROM ghcr.io/astral-sh/uv:alpine
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PORT=8000 \
|
||||||
|
UV_NO_DEV=1
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY ./pyproject.toml /app/
|
||||||
|
RUN uv sync
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
|
VOLUME ["/app"]
|
||||||
|
|
||||||
|
CMD uv run fastapi run cutt/main.py
|
||||||
48
compose.yml
Normal file
48
compose.yml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
services:
|
||||||
|
frontend-build:
|
||||||
|
build:
|
||||||
|
context: ./frontend
|
||||||
|
dockerfile: Dockerfile.frontend
|
||||||
|
container_name: cutt-frontend
|
||||||
|
environment:
|
||||||
|
VITE_BASE_URL: ${VITE_BASE_URL}
|
||||||
|
volumes:
|
||||||
|
- dist:/app/dist
|
||||||
|
|
||||||
|
backend:
|
||||||
|
build: .
|
||||||
|
container_name: cutt-backend
|
||||||
|
depends_on:
|
||||||
|
frontend-build:
|
||||||
|
condition: service_completed_successfully
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
restart: true
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
volumes:
|
||||||
|
- dist:/app/dist
|
||||||
|
ports:
|
||||||
|
- 8000:8000
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres:17
|
||||||
|
container_name: cutt-db
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- db:/var/lib/postgresql
|
||||||
|
environment:
|
||||||
|
- POSTGRES_DB=${DB_NAME}
|
||||||
|
- POSTGRES_USER=${DB_USER}
|
||||||
|
- POSTGRES_PASSWORD=${DB_PASS}
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
|
||||||
|
interval: 10s
|
||||||
|
retries: 5
|
||||||
|
start_period: 30s
|
||||||
|
timeout: 10s
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
dist:
|
||||||
|
db:
|
||||||
Reference in New Issue
Block a user