-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
122 lines (108 loc) · 3.16 KB
/
Dockerfile
File metadata and controls
122 lines (108 loc) · 3.16 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
FROM ubuntu:22.04
MAINTAINER Zinc <team@zinc.io>
USER root
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true
#================================================
# Customize sources for apt-get
#================================================
RUN echo "deb http://archive.ubuntu.com/ubuntu jammy main universe\n" > /etc/apt/sources.list \
&& echo "deb http://archive.ubuntu.com/ubuntu jammy-updates main universe\n" >> /etc/apt/sources.list \
&& echo "deb http://security.ubuntu.com/ubuntu jammy-security main universe\n" >> /etc/apt/sources.list
#========================
# Packages
#========================
RUN apt-get update -qqy \
&& apt-get -qqy --no-install-recommends install \
build-essential \
squid \
apache2-utils \
bzip2 \
ca-certificates \
runit \
sudo \
unzip \
wget \
curl \
nano \
vim-nox \
tzdata \
locales \
gnupg \
stunnel4 \
net-tools \
iputils-ping \
s3cmd \
&& apt-get -qqy dist-upgrade \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
#=====
# dumb-init trivial PID 1 for Zombie reaping
#=====
RUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_amd64.deb \
&& dpkg -i dumb-init_*.deb \
&& rm dumb-init_*.deb
#=====
# Timezone
#=====
ENV TZ "US/Eastern"
RUN echo "${TZ}" > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata
#=================
# Locale settings
#=================
ENV LANGUAGE en_US.UTF-8
ENV LANG en_US.UTF-8
RUN locale-gen en_US.UTF-8 \
&& dpkg-reconfigure --frontend noninteractive locales
#=================
# Install microsocks
#=================
RUN wget -O /tmp/microsocks.zip https://github.com/rofl0r/microsocks/archive/master.zip \
&& cd /tmp \
&& unzip microsocks.zip \
&& cd /tmp/microsocks-master \
&& make \
&& make install \
&& cd / \
&& rm /tmp/microsocks.zip /tmp/microsocks-master -r
#===============
# Configure
#===============
COPY squid.conf /etc/squid/squid.conf
COPY socks5-stunnel.conf /etc/stunnel/socks5-stunnel.conf
#==============
# Set up runit services
#==============
# squid
RUN mkdir -p /etc/service/squid \
&& /bin/bash -c "echo -e '"'#!/bin/bash\nexec /usr/sbin/squid --foreground -YC\n'"' > /etc/service/squid/run" \
&& chmod +x /etc/service/squid/run
# microsocks
RUN mkdir -p /etc/service/microsocks \
&& /bin/bash -c "echo -e '"'#!/bin/bash\nexec /usr/local/bin/microsocks -i 127.0.0.1 -p 1080\n'"' > /etc/service/microsocks/run" \
&& chmod +x /etc/service/microsocks/run
# stunnel
RUN mkdir -p /etc/service/stunnel \
&& /bin/bash -c "echo -e '"'#!/bin/bash\nexec /usr/bin/stunnel /etc/stunnel/socks5-stunnel.conf\n'"' > /etc/service/stunnel/run" \
&& chmod +x /etc/service/stunnel/run
# Health check: run the health_check.sh script every 30 seconds
HEALTHCHECK --interval=30s --timeout=5s CMD /opt/bin/health_check.sh
#=====
# Expose stunnel and squid ports
#=====
EXPOSE 5088
EXPOSE 8443
#=====
# Entry point
#=====
COPY \
entry_point.sh \
health_check.sh \
/opt/bin/
RUN chmod +x /opt/bin/entry_point.sh /opt/bin/health_check.sh
#=====
# Run
#=====
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/opt/bin/entry_point.sh"]