-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile.ubuntu
More file actions
77 lines (71 loc) · 4.22 KB
/
Copy pathDockerfile.ubuntu
File metadata and controls
77 lines (71 loc) · 4.22 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
FROM ubuntu:16.04
LABEL version="1.3.10"
LABEL description="WebOne is a HTTP(S) Proxy for vintage browsers that aren't HTTPS'in these days"
ARG REPO=https://github.com/atauenis/webone.git
ARG BRANCH=master
ARG INSTALL_DIR=/usr/local/webone
ARG SSL_SYSTEM=/etc/ssl
ARG CONFIG_DEFAULTS=/etc/webone
ENV TIMEZONE=""
ENV CONFIG_PATH=${CONFIG_DEFAULTS}/webone.conf
ENV LOG_DIR=${CONFIG_DEFAULTS}/logs
ENV SERVICE_PORT=8080
EXPOSE ${SERVICE_PORT}
COPY ./include/ /tmp/
COPY ./configuration/ /tmp/config/
HEALTHCHECK --start-period=120s --interval=3m --timeout=5s CMD s=$(curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:$SERVICE_PORT); [[ "$s" == "407" ]] || [[ "$s" == "200" ]] && exit 0 || exit 1;
USER root
WORKDIR /root
### PREPARE
RUN echo 'DPkg::Post-Invoke {"/bin/rm -f /var/cache/apt/archives/*.deb || true";};' | tee /etc/apt/apt.conf.d/clean && \
apt-get update && apt-get -y upgrade && \
apt-get -y install linux-headers-generic build-essential imagemagick ffmpeg libgdiplus git libicu-dev sudo wget zlib1g-dev ca-certificates tzdata --no-install-recommends && \
adduser webone --ingroup sudo --no-create-home --disabled-password --gecos --disabled-login && \
git config --global http.version HTTP/1.1 && \
### DOWNLOAD AND BUILD
wget --progress=dot:giga https://dot.net/v1/dotnet-install.sh && \
chmod +x ./dotnet-install.sh && \
./dotnet-install.sh -c 8.0 && \
git clone --depth 1 --branch ${BRANCH} ${REPO} && \
/root/.dotnet/dotnet build ./webone/WebOne.csproj -r linux-x64 && \
/root/.dotnet/dotnet publish ./webone/WebOne.csproj -c Release -r linux-x64 --self-contained -o ${INSTALL_DIR} && \
### CONFIGURATION
if [[ ! -z "${TIMEZONE}" ]]; then timedatectl set-timezone ${TIMEZONE}; fi && \
mkdir -p ${CONFIG_DEFAULTS} && \
mkdir -p ${LOG_DIR} && \
echo "check_certificate = off" > /root/.wgetrc && \
cp -r /tmp/config/* ${CONFIG_DEFAULTS} && \
ln -s ${LOG_DIR} /var/log/webone && \
echo -e "/var/log/webone/*.log {\nweekly\nrotate 30\nsize 2M\ncompress\ndelaycompress\ncreate 666 root root\n}" > /etc/logrotate.d/webone && \
cp /tmp/entry.sh /usr/local/bin && \
ln -s ${CONFIG_DEFAULTS}/favicon.ico ${INSTALL_DIR}/html/ && \
chown -R webone:root ${INSTALL_DIR} ${CONFIG_DEFAULTS} ${LOG_DIR} && \
chmod +x /usr/local/bin/entry.sh && \
### OPENSSL
# 0.9.x
wget --progress=dot:giga https://openssl.org/source/old/1.0.1/openssl-1.0.1.tar.gz && tar -xf openssl-*.tar.gz && \
cd openssl-* && ./config -w --prefix=/usr/local --openssldir=/usr/lib/ssl threads zlib enable-ssl no-hw && \
# 3.X
# cd && wget --progress=dot:giga https://openssl.org/source/openssl-3.3.1.tar.gz && tar -xf openssl-3.3.1.tar.gz && \
# cd openssl-3.3.1 && ./config -w --api=3.0 --prefix=/usr/local --openssldir=/usr/lib/ssl threads enable-weak-ssl-ciphers zlib enable-ssl \
# enable-md2 enable-rc2 enable-rc4 enable-rc5 enable-ssl2 enable-ssl3 enable-tls enable-dtls enable-trace no-ui-console no-shared \
# no-filenames no-tests no-docs && \
# 3.0.0
# cd && wget --progress=dot:giga https://openssl.org/source/old/3.0/openssl-3.0.0.tar.gz && tar -xf openssl-3.0.0.tar.gz && \
# cd openssl-3.0.0 && ./config -w --release --prefix=/usr/local --openssldir=/usr/lib/ssl threads enable-weak-ssl-ciphers zlib enable-ssl \
# enable-md2 enable-rc2 enable-rc4 enable-rc5 enable-ssl2 enable-ssl3 enable-tls enable-dtls enable-trace no-ui-console no-shared no-filenames no-tests && \
make && \
apt-get -y purge openssl --no-install-recommends && \
# make -s -i install_sw && make -s -i install_ssldirs && \
make -s -i install && \
rm /usr/lib/ssl/openssl.cnf && ln -s ${CONFIG_DEFAULTS}/openssl_webone.cnf /usr/lib/ssl/openssl.cnf && \
# sed '/\[default_sect\]/a CipherString = DEFAULT@SECLEVEL=0' /usr/lib/ssl/openssl.cnf > ./openssl.cnf && mv ./openssl.cnf /usr/lib/ssl/ && \
### CLEANUP
apt-get -y purge build-essential linux-headers-generic git libicu-dev zlib1g-dev && \
cd ${INSTALL_DIR} && rm -fr *.conf *.cnf README.md CONTRIBUTING.md && \
cd /tmp && rm -fr .??* .[^.] * && \
cd /var/cache && rm -fr .??* .[^.] * && \
cd && rm -rf .??* .[^.] * && \
rm -rf /var/lib/apt/lists/*
USER webone
ENTRYPOINT [ "entry.sh" ]