forked from kalaksi/docker-tinyproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.debian
More file actions
49 lines (42 loc) · 2.33 KB
/
Copy pathDockerfile.debian
File metadata and controls
49 lines (42 loc) · 2.33 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
FROM debian:bullseye-slim
LABEL maintainer="kalaksi@users.noreply.github.com"
# See tinyproxy.conf for better explanation of these values.
# Insert any value (preferably "yes") to disable the Via-header:
ENV DISABLE_VIA_HEADER ""
# Set this to e.g. tinyproxy.stats to enable stats-page on that address:
ENV STAT_HOST ""
ENV MAX_CLIENTS ""
# These will get deprecated in newer tinyproxy release.
ENV MIN_SPARE_SERVERS ""
ENV MAX_SPARE_SERVERS ""
# A space separated list:
ENV ALLOWED_NETWORKS ""
# Use a custom UID/GID instead of the default system UID which has a greater possibility
# for collisions with the host and other containers.
ENV TINYPROXY_UID 57981
ENV TINYPROXY_GID 57981
# Curl is for healthchecks.
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
tinyproxy curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists
RUN mv /etc/tinyproxy/tinyproxy.conf /etc/tinyproxy/tinyproxy.default.conf && \
chown -R ${TINYPROXY_UID}:${TINYPROXY_GID} /etc/tinyproxy /var/run/tinyproxy /var/log/tinyproxy
EXPOSE 8888
# Tinyproxy seems to be OK for getting privileges dropped beforehand
USER ${TINYPROXY_UID}:${TINYPROXY_GID}
ENTRYPOINT set -eu; \
CONFIG='/etc/tinyproxy/tinyproxy.conf'; \
if [ ! -f "$CONFIG" ]; then \
cp /etc/tinyproxy/tinyproxy.default.conf "$CONFIG"; \
([ -z "$DISABLE_VIA_HEADER" ] || sed -i "s|^#DisableViaHeader .*|DisableViaHeader Yes|" "$CONFIG"); \
([ -z "$STAT_HOST" ] || sed -i "s|^#StatHost .*|StatHost \"${STAT_HOST}\"|" "$CONFIG"); \
([ -z "$MAX_CLIENTS" ] || sed -i "s|^MaxClients .*|MaxClients $MAX_CLIENTS|" "$CONFIG"); \
([ -z "$MIN_SPARE_SERVERS" ] || sed -i "s|^MinSpareServers .*|MinSpareServers $MIN_SPARE_SERVERS|" "$CONFIG"); \
([ -z "$MIN_SPARE_SERVERS" ] || sed -i "s|^StartServers .*|StartServers $MIN_SPARE_SERVERS|" "$CONFIG"); \
([ -z "$MAX_SPARE_SERVERS" ] || sed -i "s|^MaxSpareServers .*|MaxSpareServers $MAX_SPARE_SERVERS|" "$CONFIG"); \
([ -z "$ALLOWED_NETWORKS" ] || for network in $ALLOWED_NETWORKS; do echo "Allow $network" >> "$CONFIG"; done); \
sed -i 's|^#LogFile .*|LogFile "/var/log/tinyproxy/tinyproxy.log"|' "$CONFIG"; \
fi; \
exec /usr/bin/tinyproxy -d;