2024-09-22 18:25:29 +02:00
|
|
|
FROM python:3.10
|
2019-02-09 19:42:36 +04:00
|
|
|
|
2024-09-27 18:10:59 +02:00
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
|
2020-04-19 00:27:48 +03:00
|
|
|
WORKDIR /app/
|
|
|
|
|
2024-09-23 16:10:46 +02:00
|
|
|
# Install uv
|
|
|
|
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
|
2025-01-05 14:57:42 +00:00
|
|
|
COPY --from=ghcr.io/astral-sh/uv:0.5.11 /uv /uvx /bin/
|
2020-04-19 00:27:48 +03:00
|
|
|
|
2024-09-23 16:10:46 +02:00
|
|
|
# Place executables in the environment at the front of the path
|
|
|
|
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#using-the-environment
|
|
|
|
ENV PATH="/app/.venv/bin:$PATH"
|
:recycle: Refactor backend, settings, DB sessions, types, configs, plugins (#158)
* :recycle: Refactor backend, update DB session handling
* :sparkles: Add mypy config and plugins
* :heavy_plus_sign: Use Python-jose instead of PyJWT
as it has some extra functionalities and features
* :sparkles: Add/update scripts for test, lint, format
* :wrench: Update lint and format configs
* :art: Update import format, comments, and types
* :art: Add types to config
* :sparkles: Add types for all the code, and small fixes
* :art: Use global imports to simplify exploring with Jupyter
* :recycle: Import schemas and models, instead of each class
* :truck: Rename db_session to db for simplicity
* :pushpin: Update dependencies installation for testing
2020-04-20 19:03:13 +02:00
|
|
|
|
2024-09-23 16:10:46 +02:00
|
|
|
# Compile bytecode
|
|
|
|
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode
|
|
|
|
ENV UV_COMPILE_BYTECODE=1
|
|
|
|
|
|
|
|
# uv Cache
|
|
|
|
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#caching
|
|
|
|
ENV UV_LINK_MODE=copy
|
|
|
|
|
|
|
|
# Install dependencies
|
2024-09-23 18:53:08 +02:00
|
|
|
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
|
2024-09-23 16:10:46 +02:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
|
|
--mount=type=bind,source=uv.lock,target=uv.lock \
|
|
|
|
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
|
|
|
uv sync --frozen --no-install-project
|
2019-02-09 19:42:36 +04:00
|
|
|
|
|
|
|
ENV PYTHONPATH=/app
|
2024-02-25 18:48:02 +01:00
|
|
|
|
2024-09-22 18:19:57 +02:00
|
|
|
COPY ./scripts /app/scripts
|
2024-03-12 16:09:27 +01:00
|
|
|
|
2024-09-23 16:10:46 +02:00
|
|
|
COPY ./pyproject.toml ./uv.lock ./alembic.ini /app/
|
2024-02-25 18:48:02 +01:00
|
|
|
|
|
|
|
COPY ./app /app/app
|
2024-09-20 17:12:40 +02:00
|
|
|
|
2024-09-23 18:53:08 +02:00
|
|
|
# Sync the project
|
|
|
|
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
|
2024-09-23 16:10:46 +02:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
|
|
uv sync
|
|
|
|
|
2024-09-20 17:12:40 +02:00
|
|
|
CMD ["fastapi", "run", "--workers", "4", "app/main.py"]
|