first commit

This commit is contained in:
2026-04-16 20:06:11 +08:00
commit 4e0df5f13e
3 changed files with 43 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
FROM python:3.14-slim
WORKDIR /workspace
ENV UV_PROJECT_ENVIRONMENT=/usr/local
ENV PYTHONUNBUFFERED=1
# Install curl (for healthcheck).
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install UV from the official image and copy it to the current image.
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# 先复制依赖文件并同步
COPY pyproject.toml uv.lock ./
# 确保 uv 会把项目安装为可导入的包 (Editable mode)
RUN uv sync --no-dev --no-install-project -v
# 现在的结构中,核心代码在 ./app 目录下
COPY . .
RUN uv sync --no-dev
EXPOSE 8000
# CMD ["python", "main.py"]
# CMD ["uv", "run", "python", "main.py"]
CMD ["uv", "run", "python", "-m", "app.main"]
View File
+12
View File
@@ -0,0 +1,12 @@
version: "3.8"
services:
app:
build: .
environment:
- DATABASE_URL=${DATABASE_URL}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 10s
timeout: 3s
retries: 3