32 lines
899 B
Docker
32 lines
899 B
Docker
# Use a Python image with uv pre-installed
|
|
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
|
|
|
|
# Install dependencies
|
|
WORKDIR /app
|
|
|
|
# Set timezone
|
|
ENV TZ=Asia/Tokyo
|
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|
|
|
# Enable bytecode compilation
|
|
ENV UV_COMPILE_BYTECODE=1
|
|
|
|
# Copy from the cache instead of linking since it's a container
|
|
ENV UV_LINK_MODE=copy
|
|
|
|
# Install the project's dependencies using the lockfile and pyproject.toml
|
|
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 --no-dev
|
|
|
|
# Copy the rest of the application
|
|
COPY . /app
|
|
|
|
# Final sync to include the project itself
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
uv sync --frozen --no-dev
|
|
|
|
# Run the bot
|
|
CMD ["uv", "run", "main.py"]
|