fix: 修复 Docker 首页模板加载失败
This commit is contained in:
+2
-3
@@ -7,9 +7,8 @@ WORKDIR /app
|
||||
|
||||
RUN adduser --disabled-password --gecos "" appuser
|
||||
|
||||
COPY pyproject.toml uv.lock ./
|
||||
RUN pip install --no-cache-dir uv \
|
||||
&& uv pip install --system --no-cache .
|
||||
COPY requirements.txt ./
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY app ./app
|
||||
COPY .env.example ./.env.example
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
beautifulsoup4>=4.12.3
|
||||
fastapi>=0.115.0
|
||||
httpx>=0.27.0
|
||||
jinja2>=3.1.4
|
||||
pydantic>=2.8.0
|
||||
pydantic-settings>=2.4.0
|
||||
sqlalchemy>=2.0.32
|
||||
uvicorn[standard]>=0.30.6
|
||||
@@ -29,3 +29,19 @@ def test_real_env_file_is_gitignored():
|
||||
gitignore_lines = (ROOT / ".gitignore").read_text(encoding="utf-8").splitlines()
|
||||
|
||||
assert ".env" in gitignore_lines
|
||||
|
||||
|
||||
def test_dockerfile_does_not_bootstrap_uv_from_runtime_pip():
|
||||
dockerfile_content = (ROOT / "Dockerfile").read_text(encoding="utf-8")
|
||||
|
||||
assert "pip install --no-cache-dir uv" not in dockerfile_content
|
||||
assert "uv pip install" not in dockerfile_content
|
||||
|
||||
|
||||
def test_dockerfile_installs_project_without_build_isolation():
|
||||
dockerfile_content = (ROOT / "Dockerfile").read_text(encoding="utf-8")
|
||||
|
||||
assert "COPY requirements.txt ./" in dockerfile_content
|
||||
assert "pip install --no-cache-dir -r requirements.txt" in dockerfile_content
|
||||
assert "pip install --no-cache-dir ." not in dockerfile_content
|
||||
assert "pip install --no-cache-dir --no-build-isolation ." not in dockerfile_content
|
||||
|
||||
Reference in New Issue
Block a user