-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (43 loc) · 1.08 KB
/
Dockerfile
File metadata and controls
57 lines (43 loc) · 1.08 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
56
57
# syntax=docker/dockerfile:1
# artifacts: false
# platforms: linux/amd64
FROM python:3.13-slim-bookworm
# 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}
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
VOLUME /data
WORKDIR /app/
# Copy only necessary files for installation and runtime
COPY pyproject.toml .
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
cat > src/common/version.py <<EOF
"""Version information for support-bot."""
__version__ = "${BUILD_VERSION}"
EOF
# install python dependencies
python -m pip install --no-cache-dir .
# set ownership of app and data directories
mkdir -p /data
chown -R supportbot:supportbot /app /data
_SETUP
# switch to non-root user
USER supportbot
CMD ["python", "-m", "src"]