-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (40 loc) · 1.18 KB
/
Copy pathDockerfile
File metadata and controls
52 lines (40 loc) · 1.18 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
# syntax=docker/dockerfile:1.4
FROM python:3.12-slim AS runtime
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
curl \
libffi-dev \
libjpeg62-turbo-dev \
zlib1g-dev \
libfreetype6-dev \
liblcms2-dev \
libopenjp2-7 \
libtiff6 \
libwebp-dev \
libpq-dev \
libzbar0 \
fonts-dejavu-core \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies first (for caching)
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev
RUN useradd --create-home --shell /bin/bash bot
RUN mkdir -p /app/logs /app/data \
&& chown -R bot:bot /app
ARG GIT_COMMIT=unknown
ENV GIT_COMMIT=${GIT_COMMIT}
# Cache buster for source code only
# Use: docker build --build-arg CACHEBUST=$(date +%s) -t skynet_bot .
# Or: docker build --build-arg CACHEBUST=$(git rev-parse HEAD) -t skynet_bot .
ARG CACHEBUST=1
# Copy source code
COPY --chown=bot:bot . .
USER bot
CMD ["uv", "run", "--no-sync", "python", "start.py"]