generated from Templates/Baseline
wip
This commit is contained in:
parent
5b0cab4a4e
commit
c009f5646b
@ -37,14 +37,15 @@ RUN apk add --no-cache \
|
|||||||
RUN mv /etc/tinyproxy/tinyproxy.conf /etc/tinyproxy/tinyproxy.default.conf && \
|
RUN mv /etc/tinyproxy/tinyproxy.conf /etc/tinyproxy/tinyproxy.default.conf && \
|
||||||
touch /etc/tinyproxy/tinyproxy.conf
|
touch /etc/tinyproxy/tinyproxy.conf
|
||||||
|
|
||||||
|
COPY entrypoint.sh /swarmproxy/entrypoint.sh
|
||||||
WORKDIR /swarmproxy
|
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}
|
USER ${TINYPROXY_UID}:${TINYPROXY_GID}
|
||||||
|
|
||||||
EXPOSE 8888
|
EXPOSE 8888
|
||||||
|
|
||||||
ENTRYPOINT ["/swarmproxy/entrypoint.sh"]
|
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
|
set -e
|
||||||
|
|
||||||
CONFIG = "/etc/tinyrpoxy/tinyproxy.conf"
|
CONFIG="/etc/tinyproxy/tinyproxy.conf"
|
||||||
|
|
||||||
function writeConfig() {
|
function writeConfig() {
|
||||||
cat << EOF >> "$CONFIG"
|
cat << EOF >> "$CONFIG"
|
||||||
@ -19,11 +19,6 @@ LogLevel $LOGLEVEL
|
|||||||
MaxClients $MAXCLIENTS
|
MaxClients $MAXCLIENTS
|
||||||
ViaProxyName "tinyproxy"
|
ViaProxyName "tinyproxy"
|
||||||
|
|
||||||
Filter "$FILTER_FILE"
|
|
||||||
FilterURLs Off
|
|
||||||
FilterCaseSensitive Off
|
|
||||||
FilterDefaultDeny Yes
|
|
||||||
|
|
||||||
Allow 127.0.0.1/8
|
Allow 127.0.0.1/8
|
||||||
Allow 10.0.0.0/8
|
Allow 10.0.0.0/8
|
||||||
|
|
||||||
@ -35,9 +30,37 @@ function addUpstreamConfig() {
|
|||||||
[ -z "$UPSTREAM_PROXY" ] || echo "upstream http $UPSTREAM_PROXY \".\"" >> "$CONFIG"
|
[ -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() {
|
function main() {
|
||||||
writeConfig
|
writeConfig
|
||||||
addUpstreamConfig
|
addUpstreamConfig
|
||||||
|
addFilterConfig
|
||||||
|
showConfig
|
||||||
|
execTinyproxy $@
|
||||||
}
|
}
|
||||||
|
|
||||||
main $@
|
main $@
|
||||||
|
Loading…
Reference in New Issue
Block a user