fix: docker alembic

This commit is contained in:
Leon
2025-07-17 19:31:36 +02:00
parent 8f3634d0dc
commit fe55a49f8d
6 changed files with 35 additions and 118 deletions

View File

@@ -6,17 +6,17 @@ COPY --from=ghcr.io/astral-sh/uv:0.7.20 /uv /bin/uv
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
WORKDIR /app
COPY pyproject.toml uv.lock ./
COPY ./alembic.ini ./pyproject.toml ./uv.lock ./
COPY ./alembic ./alembic
COPY ./app ./app
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen
COPY app .
RUN --mount=type=cache,target=/root/.cache/uv uv sync --frozen
FROM base
COPY --from=builder /app /app
WORKDIR /app
EXPOSE 8000
ENV PATH="/app/.venv/bin:$PATH"
CMD ["sh", "-c", "uv run alembic upgrade head && uvicorn app.main:app --host 0.0.0.0 --port 8000"]
CMD ["sh", "-c", "alembic upgrade head && uvicorn app.main:app --host 0.0.0.0 --port 8000"]