-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (38 loc) · 1.28 KB
/
Dockerfile
File metadata and controls
54 lines (38 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
FROM ghcr.io/astral-sh/uv:0.6.2 AS uv
FROM python:3.12.9-slim
ENV UV_PROJECT_ENVIRONMENT=/usr/local
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy
WORKDIR /app
# dependencies
COPY vendor/ vendor/
COPY pyproject.toml ./
COPY uv.lock ./
RUN --mount=from=uv,source=/uv,target=/bin/uv \
--mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev --package HexBug-bot --extra data --no-install-workspace
# project code
COPY bot/ bot/
COPY data/ data/
COPY CHANGELOG.md bot/src/HexBug/resources/
# sync dependencies with data to build registry
RUN --mount=from=uv,source=/uv,target=/bin/uv \
--mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev --package HexBug-bot --extra data
RUN hexbug build
# sync dependencies without data to reduce image size hopefully idk i didn't check
RUN --mount=from=uv,source=/uv,target=/bin/uv \
--mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev --package HexBug-bot
# Alembic files
COPY alembic/ alembic/
COPY alembic.ini ./
# NOTE: this must be a list, otherwise signals (eg. SIGINT) are not forwarded to the bot
CMD ["hexbug", "bot"]
HEALTHCHECK \
--interval=1m \
--timeout=30s \
--start-period=2m \
--start-interval=15s \
--retries=3 \
CMD ["hexbug", "health-check"]