1
0
mirror of https://github.com/b4tman/docker-squid.git synced 2024-12-21 08:33:13 +00:00

CMD /run.sh

This commit is contained in:
Dmitry Belyaev 2024-03-26 12:32:52 +03:00
parent 2bd55e0a98
commit a3b674e1d5
Signed by: b4tman
GPG Key ID: 41A00BF15EA7E5F3
2 changed files with 17 additions and 1 deletions

View File

@ -127,6 +127,8 @@ COPY --from=build /usr/lib/squid/ /usr/lib/squid/
COPY --from=build /usr/share/squid/ /usr/share/squid/
COPY --from=build /usr/sbin/squid /usr/sbin/squid
COPY --from=build /usr/bin/squidclient /usr/bin/squidclient
COPY --chmod=755 run.sh /
RUN install -d -o squid -g squid \
/var/cache/squid \
@ -144,4 +146,4 @@ EXPOSE 3128/tcp
USER squid
CMD ["sh", "-c", "rm -f /var/run/squid/squid.pid ; /usr/sbin/squid -f ${SQUID_CONFIG_FILE} --foreground -z && exec /usr/sbin/squid -f ${SQUID_CONFIG_FILE} --foreground -YCd 1"]
CMD ["/run.sh"]

14
run.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/sh
set -x
# force remove pid
if [ -e /var/run/squid/squid.pid ]; then
rm -f /var/run/squid/squid.pid
fi
# init cache
/usr/sbin/squid -f "${SQUID_CONFIG_FILE}" --foreground -z
# run squid
exec /usr/sbin/squid -f "${SQUID_CONFIG_FILE}" --foreground -YCd 1