-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (42 loc) · 1.25 KB
/
Copy pathDockerfile
File metadata and controls
55 lines (42 loc) · 1.25 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
55
# syntax=docker/dockerfile:1
FROM ghcr.io/astral-sh/uv:0.12-python3.14-trixie-slim
# CI args
ARG BRANCH
ARG BUILD_VERSION
ARG COMMIT
# note: BUILD_VERSION may be blank
ENV BRANCH=${BRANCH}
ENV BUILD_VERSION=${BUILD_VERSION}
ENV COMMIT=${COMMIT}
ENV UV_PROJECT_ENVIRONMENT=/opt/venv
ENV VIRTUAL_ENV=/opt/venv
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
VOLUME /data
WORKDIR /app/
# Copy only necessary files for installation and runtime
COPY pyproject.toml uv.lock README.md ./
COPY src/ src/
COPY assets/ assets/
RUN <<_SETUP
#!/bin/bash
set -e
# install system dependencies
apt-get update -y
apt-get install -y --no-install-recommends git
apt-get clean
rm -rf /var/lib/apt/lists/*
# create non-root user
useradd -m -u 1000 -s /bin/bash supportbot
# write the version to the version file
printf '%s\n' '"""Version information for support-bot."""' '' "__version__ = \"${BUILD_VERSION}\"" \
> src/common/version.py
# install python dependencies
uv sync --frozen --no-build --no-dev --no-install-project --python python --no-python-downloads
# set ownership of app and data directories
mkdir -p /data
chown -R supportbot:supportbot /app /data "${VIRTUAL_ENV}"
_SETUP
# switch to non-root user
USER 1000
CMD ["python", "-m", "src"]