Off by default, since it adds about 400 MB. Documented with the clip recipe and in the configuration reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WgBfkm4rCmtd1T4vHWjEPx
82 lines
3.3 KiB
Docker
82 lines
3.3 KiB
Docker
FROM python:3.13
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# Install uv
|
|
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
|
|
COPY --from=ghcr.io/astral-sh/uv:0.9.26 /uv /uvx /bin/
|
|
|
|
# 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
|
|
|
|
WORKDIR /app/
|
|
|
|
# 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"
|
|
|
|
# /app/.venv holds the app and nothing of anybody else's, so there is nothing
|
|
# here to adopt: node code gets a venv of its own on the data volume, which is
|
|
# what the Modules screen installs into. A `pip install fluksio` into an
|
|
# environment somebody already works in is the case that adopts instead.
|
|
ENV NODE_VENV=managed
|
|
|
|
# ffmpeg for node code that transcodes, such as the clip recipe in
|
|
# docs/code/nodes.md. Off by default: Debian's package and what it pulls in add
|
|
# about 400 MB. Set WITH_FFMPEG=true in .env and rebuild to include it.
|
|
ARG WITH_FFMPEG=false
|
|
RUN if [ "$WITH_FFMPEG" = true ]; then \
|
|
apt-get update \
|
|
&& apt-get install -y --no-install-recommends ffmpeg \
|
|
&& rm -rf /var/lib/apt/lists/*; \
|
|
fi
|
|
|
|
# Install dependencies
|
|
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
|
|
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-workspace --package fluksio --extra server
|
|
|
|
COPY ./backend/scripts /app/backend/scripts
|
|
|
|
# README.md and LICENSE come along because pyproject.toml names them in
|
|
# `readme` and `license-files`; hatchling reads both when it builds the
|
|
# package metadata below, and fails the build if either is missing.
|
|
COPY ./backend/pyproject.toml ./backend/alembic.ini ./backend/README.md ./backend/LICENSE /app/backend/
|
|
|
|
COPY ./backend/fluksio /app/backend/fluksio
|
|
|
|
# The worker is a workspace member of its own, so the engine's sync needs it
|
|
# present to resolve the dependency on it. It is also what the engine runs
|
|
# node code with.
|
|
COPY ./worker /app/worker
|
|
|
|
# Sync the project
|
|
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
|
|
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 --package fluksio --extra server
|
|
|
|
# Connectors are ordinary installed packages found through the
|
|
# `fluksio.node_types` entry point. `make connectors` builds them into here;
|
|
# an image with none is the normal case.
|
|
COPY ./backend/connector-wheels /tmp/connector-wheels
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
sh -c 'ls /tmp/connector-wheels/*.whl >/dev/null 2>&1 \
|
|
&& uv pip install --python /app/.venv/bin/python /tmp/connector-wheels/*.whl \
|
|
|| echo "no connectors bundled"'
|
|
|
|
WORKDIR /app/backend/
|
|
|
|
# Single worker on purpose: the process hosts the flow engine, and a second
|
|
# worker would be a second engine — duplicated subscriptions, cron ticks and
|
|
# webhooks. Scaling out is the M5 worker split, not more uvicorn processes.
|
|
CMD ["fastapi", "run", "fluksio/main.py"]
|