forked from zytedata/zyte-smartproxy-headless-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
56 lines (44 loc) · 1.4 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
44
45
46
47
48
49
50
51
52
53
54
55
56
###############################################################################
# BUILD STAGE
FROM golang:1.14-alpine AS build-env
WORKDIR /app
RUN set -x \
&& apk --no-cache --update add \
bash \
ca-certificates \
git \
make \
upx
ADD https://doc.scrapinghub.com/_downloads/639adb203cdcb1249a5a7618d9f4fa96/crawlera-ca.crt /usr/local/share/ca-certificates/crawlera-ca.crt
RUN set -x \
&& sha1sum /usr/local/share/ca-certificates/crawlera-ca.crt | cut -f1 -d' ' | \
while read -r sum _; do \
if [ "${sum}" != "5798e59f6f7ecad3c0e1284f42b07dcaa63fbd37" ]; then \
echo "Incorrect CA certificate checksum ${sum}"; \
exit 1; \
fi; done \
&& update-ca-certificates
COPY . /app
RUN set -x \
&& make static
ARG upx=
RUN set -x \
&& if [ -n "$upx" ]; then \
upx --ultra-brute -qq ./crawlera-headless-proxy; \
fi
###############################################################################
# PACKAGE STAGE
FROM scratch
ENTRYPOINT ["/crawlera-headless-proxy"]
ENV CRAWLERA_HEADLESS_BINDIP=0.0.0.0 \
CRAWLERA_HEADLESS_BINDPORT=3128 \
CRAWLERA_HEADLESS_PROXYAPIIP=0.0.0.0 \
CRAWLERA_HEADLESS_PROXYAPIPORT=3130 \
CRAWLERA_HEADLESS_CONFIG=/config.toml
EXPOSE 3128 3130
COPY --from=build-env \
/etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build-env \
/app/crawlera-headless-proxy \
/app/config.toml \
/