Source code for my personal quote bot project.
1# The following Dockerfile code has been taken from the uv documentation
2# and adapted to suit my program: https://docs.astral.sh/uv/guides/integration/docker/
3
4# Use a Python image with uv pre-installed
5FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
6
7# Install the project into `/app`
8WORKDIR /app
9
10# Enable bytecode compilation
11ENV UV_COMPILE_BYTECODE=1
12
13# Copy from the cache instead of linking since it's a mounted volume
14ENV UV_LINK_MODE=copy
15
16# Install the project's dependencies using the lockfile and settings
17RUN --mount=type=cache,target=/root/.cache/uv \
18 --mount=type=bind,source=uv.lock,target=uv.lock \
19 --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
20 uv sync --frozen --no-install-project --no-dev
21
22# Then, add the rest of the project source code and install it
23# Installing separately from its dependencies allows optimal layer caching
24ADD . /app
25RUN --mount=type=cache,target=/root/.cache/uv \
26 uv sync --frozen --no-dev
27
28# Place executables in the environment at the front of the path
29ENV PATH="/app/.venv/bin:$PATH"
30
31# Make port 8080 available to the world outside this container
32EXPOSE 8080
33
34# Reset the entrypoint, don't invoke `uv`
35ENTRYPOINT []
36CMD ["uv", "run", "schedule_script.py", "--no-simulation-mode"]