File tree Expand file tree Collapse file tree 4 files changed +19
-5
lines changed
Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 11FROM debian:12.10-slim
22
33RUN apt-get update && \
4- apt-get install -y lsb-release wget gpg ruby nginx netcat-openbsd procps && \
4+ apt-get install -y --no-install-recommends lsb-release wget gpg ruby nginx netcat-openbsd procps && \
55 rm -rf /var/lib/apt/lists/*
66RUN mkdir -p /etc/apt/keyrings
77RUN wget -O- https://rspamd.com/apt-stable/gpg.key | gpg --dearmor | tee /etc/apt/keyrings/rspamd.gpg > /dev/null
@@ -28,6 +28,11 @@ COPY start.sh /start.sh
2828
2929RUN chmod +x /start.sh
3030
31+ # Ensure _rspamd user can write nginx config at runtime
32+ RUN chown -R _rspamd:_rspamd /etc/nginx
33+
3134ENV PORT=8010
3235
36+ USER _rspamd
37+
3338CMD ["/start.sh" ]
Original file line number Diff line number Diff line change @@ -6,3 +6,8 @@ COPY requirements.txt .
66RUN pip install --no-cache-dir -r requirements.txt
77
88COPY . .
9+
10+ # Ensure nobody user can write pytest cache files
11+ RUN chown -R nobody:nogroup /app
12+
13+ USER nobody
Original file line number Diff line number Diff line change @@ -4,10 +4,7 @@ ARG DANTE_VER=1.4.4
44ARG DANTE_URL=https://www.inet.no/dante/files/dante-$DANTE_VER.tar.gz
55ARG DANTE_SHA256=1973c7732f1f9f0a4c0ccf2c1ce462c7c25060b25643ea90f9b98f53a813faec
66
7- RUN <<EOR
8- apt-get update
9- apt-get install -y build-essential curl
10- EOR
7+ RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates build-essential curl && rm -rf /var/lib/apt/lists/*
118
129RUN <<EOR
1310set -eu
@@ -26,5 +23,7 @@ COPY --from=base /usr/local/sbin/sockd /usr/local/sbin/sockd
2623
2724COPY --chmod=0755 entrypoint.sh /entrypoint.sh
2825
26+ USER nobody
27+
2928ENTRYPOINT ["/entrypoint.sh" ]
3029CMD ["/usr/local/sbin/sockd" ]
Original file line number Diff line number Diff line change @@ -15,5 +15,10 @@ RUN pip install --no-cache-dir -r requirements.txt
1515# Copy test files
1616COPY . .
1717
18+ # Ensure nobody user can write pytest cache and coverage files
19+ RUN chown -R nobody:nogroup /app
20+
21+ USER nobody
22+
1823# Default command (can be overridden)
1924CMD ["pytest" , "-v" ]
You can’t perform that action at this time.
0 commit comments