This repository has been archived by the owner on Sep 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
43 lines (33 loc) · 1.65 KB
/
Dockerfile
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
FROM alpine:3.10.0
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories;
RUN apk update && apk upgrade
RUN apk add squid \
stunnel \
bash;
WORKDIR /root
COPY stunnel.pem /etc/stunnel/stunnel.pem
RUN sed -i 's/http_access deny all/http_access allow all/g' /etc/squid/squid.conf; \
sed -i 's/http_port 3128/http_port 127.0.0.1:3128/g' /etc/squid/squid.conf;
RUN sed -i 's/\/run\/stunnel\/stunnel.pid/\/var\/run\/stunnel\/stunnel.pid/g' /etc/stunnel/stunnel.conf; \
sed -i 's/#verify = 2/verify = 3/g' /etc/stunnel/stunnel.conf; \
sed -i 's/#CAfile = \/etc\/stunnel\/certs.pem/CAfile = \/etc\/stunnel\/stunnel.pem/g' /etc/stunnel/stunnel.conf; \
sed -i 's/client = yes/#client = yes/g' /etc/stunnel/stunnel.conf;
RUN echo "" >> /etc/stunnel/stunnel.conf; \
echo "foreground = yes" >> /etc/stunnel/stunnel.conf; \
echo "delay = no" >> /etc/stunnel/stunnel.conf; \
echo "output = /var/log/stunnel/stunnel.log" >> /etc/stunnel/stunnel.conf; \
echo "" >> /etc/stunnel/stunnel.conf; \
echo "[sproxy]" >> /etc/stunnel/stunnel.conf; \
echo "accept = 8000" >> /etc/stunnel/stunnel.conf; \
echo "connect = 127.0.0.1:3128" >> /etc/stunnel/stunnel.conf; \
echo "cert = /etc/stunnel/stunnel.pem" >> /etc/stunnel/stunnel.conf;
RUN mkdir -p /var/log/stunnel; \
chown -R stunnel:stunnel /var/log/stunnel; \
mkdir -p /var/run/stunnel; \
chown -R stunnel:stunnel /var/run/stunnel;
RUN touch docker-startup.sh; \
chmod 755 docker-startup.sh;
RUN echo '#!/bin/bash' >> docker-startup.sh; \
echo "squid && stunnel;" >> docker-startup.sh;
EXPOSE 8000
CMD ["/root/docker-startup.sh"]