social media crossposting tool. 3rd time's the charm
mastodon
misskey
crossposting
bluesky
1FROM python:3.12-slim-bookworm
2COPY --from=ghcr.io/astral-sh/uv:0.7.12 /uv /uvx /bin/
3
4WORKDIR /app
5
6RUN \
7 --mount=type=cache,id=apt-cache,target=/var/cache/apt,sharing=locked \
8 --mount=type=cache,id=apt-lib-cache,target=/var/lib/apt,sharing=locked \
9 apt-get update; \
10 apt-get dist-upgrade -yq; \
11 apt-get install -y --no-install-recommends \
12 ffmpeg \
13 libmagic1
14
15# Enable bytecode compilation
16ENV UV_COMPILE_BYTECODE=1
17
18# Copy from the cache instead of linking since it's a mounted volume
19ENV UV_LINK_MODE=copy
20
21# Install the project's dependencies using the lockfile and settings
22RUN --mount=type=cache,target=/root/.cache/uv \
23 --mount=type=bind,source=uv.lock,target=uv.lock \
24 --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
25 uv sync --locked --no-install-project --no-dev
26
27# Define app data volume
28VOLUME /app/data
29
30# Then, add the rest of the project source code and install it
31# Installing separately from its dependencies allows optimal layer caching
32COPY . /app
33RUN --mount=type=cache,target=/root/.cache/uv \
34 uv sync --locked --no-dev
35
36# Place executables in the environment at the front of the path
37ENV PATH="/app/.venv/bin:$PATH"
38
39# Set entrypoint to run the app using uv
40ENTRYPOINT ["uv", "run", "main.py"]