forked from kalaksi/docker-tinyproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.alpine
More file actions
42 lines (35 loc) · 1.76 KB
/
Dockerfile.alpine
File metadata and controls
42 lines (35 loc) · 1.76 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
# Copyright (c) 2018 kalaksi@users.noreply.github.com.
# This work is licensed under the terms of the MIT license. For a copy, see <https://opensource.org/licenses/MIT>.
FROM alpine:3.17.0
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 ""
# 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 apk add --no-cache \
tinyproxy curl
RUN mv /etc/tinyproxy/tinyproxy.conf /etc/tinyproxy/tinyproxy.default.conf && \
chown -R ${TINYPROXY_UID}:${TINYPROXY_GID} /etc/tinyproxy /var/log/tinyproxy
EXPOSE 8888
# Tinyproxy seems to be OK for getting privileges dropped beforehand
USER ${TINYPROXY_UID}:${TINYPROXY_GID}
CMD 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 "$ALLOWED_NETWORKS" ] || for network in $ALLOWED_NETWORKS; do echo "Allow $network" >> "$CONFIG"; done); \
sed -i 's|^LogFile |# LogFile |' "$CONFIG"; \
fi; \
exec /usr/bin/tinyproxy -d;