From 4e0df5f13e0fb0b950281224cd3f0bf174a93e9d Mon Sep 17 00:00:00 2001 From: Zayden Jung Date: Thu, 16 Apr 2026 20:06:11 +0800 Subject: [PATCH] first commit --- Dockerfile | 31 +++++++++++++++++++++++++++++++ README.md | 0 docker-compose.yml | 12 ++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..95be05a --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a6467e0 --- /dev/null +++ b/docker-compose.yml @@ -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