generated from Templates/Baseline
Adds entrypoint #6
@ -37,14 +37,15 @@ RUN apk add --no-cache \
|
||||
RUN mv /etc/tinyproxy/tinyproxy.conf /etc/tinyproxy/tinyproxy.default.conf && \
|
||||
touch /etc/tinyproxy/tinyproxy.conf
|
||||
|
||||
COPY entrypoint.sh /swarmproxy/entrypoint.sh
|
||||
WORKDIR /swarmproxy
|
||||
COPY entrypoint.sh entrypoint.sh
|
||||
|
||||
RUN chown -R ${TINYPROXY_UID}:${TINYPROXY_GID} /etc/tinyproxy /var/log/tinyproxy
|
||||
RUN chown -R ${TINYPROXY_UID}:${TINYPROXY_GID} /etc/tinyproxy /var/log/tinyproxy /swarmproxy && \
|
||||
chmod +x /swarmproxy/entrypoint.sh
|
||||
|
||||
USER ${TINYPROXY_UID}:${TINYPROXY_GID}
|
||||
|
||||
EXPOSE 8888
|
||||
|
||||
ENTRYPOINT ["/swarmproxy/entrypoint.sh"]
|
||||
CMD ["/usr/bin/tinyproxy", "-d"]
|
||||
CMD ["-d"]
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -e
|
||||
|
||||
CONFIG = "/etc/tinyrpoxy/tinyproxy.conf"
|
||||
CONFIG="/etc/tinyproxy/tinyproxy.conf"
|
||||
|
||||
function writeConfig() {
|
||||
cat << EOF >> "$CONFIG"
|
||||
@ -19,11 +19,6 @@ LogLevel $LOGLEVEL
|
||||
MaxClients $MAXCLIENTS
|
||||
ViaProxyName "tinyproxy"
|
||||
|
||||
Filter "$FILTER_FILE"
|
||||
FilterURLs Off
|
||||
FilterCaseSensitive Off
|
||||
FilterDefaultDeny Yes
|
||||
|
||||
Allow 127.0.0.1/8
|
||||
Allow 10.0.0.0/8
|
||||
|
||||
@ -35,9 +30,37 @@ function addUpstreamConfig() {
|
||||
[ -z "$UPSTREAM_PROXY" ] || echo "upstream http $UPSTREAM_PROXY \".\"" >> "$CONFIG"
|
||||
}
|
||||
|
||||
function addFilterConfig() {
|
||||
if [ -f "$FILTER_FILE" ]; then
|
||||
cat << FBLOCK >> "$CONFIG"
|
||||
Filter "$FILTER_FILE"
|
||||
FilterURLs Off
|
||||
FilterCaseSensitive Off
|
||||
FilterDefaultDeny Yes
|
||||
FBLOCK
|
||||
else
|
||||
echo "🦁 FILTER_FILE not found or set."
|
||||
fi
|
||||
}
|
||||
|
||||
function showConfig() {
|
||||
echo "🦁 Final Swarmproxy config 🦁"
|
||||
cat "$CONFIG"
|
||||
}
|
||||
|
||||
function execTinyproxy() {
|
||||
echo "🦁 Starting Tinyproxy..."
|
||||
echo "args count: $#"
|
||||
echo "args: $@"
|
||||
exec "/usr/bin/tinyproxy" "$@"
|
||||
}
|
||||
|
||||
function main() {
|
||||
writeConfig
|
||||
addUpstreamConfig
|
||||
addFilterConfig
|
||||
showConfig
|
||||
execTinyproxy $@
|
||||
}
|
||||
|
||||
main $@
|
||||
|
Loading…
Reference in New Issue
Block a user