File size: 1,672 Bytes
72d4347
e90e507
 
72d4347
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ed61d1f
72d4347
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
593698b
5b9e51e
72d4347
5b9e51e
 
61c8944
 
 
 
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
FROM perl:5.40-slim-bookworm

RUN set -eux; \
	apt-get update; \
	apt-get install -y --no-install-recommends \
		ca-certificates \
		wget \
	; \
	rm -rf /var/lib/apt/lists/*

# secure by default ♥ (thanks to sri!)
ENV PERL_CPANM_OPT --verbose --notest --mirror https://cpan.metacpan.org
# TODO find a way to make --mirror-only / SSL work with backpan too :(
#RUN cpanm Digest::SHA Module::Signature
# TODO find a way to make --verify work with backpan as well :'(
#ENV PERL_CPANM_OPT $PERL_CPANM_OPT --verify

# reinstall cpanm itself, for good measure
RUN cpanm App::cpanminus

RUN set -eux; \
	savedAptMark="$(apt-mark showmanual)"; \
	apt-get update; \
	apt-get install -y --no-install-recommends \
		gcc \
		libc-dev \
		libssl-dev \
		zlib1g-dev \
	; \
	rm -rf /var/lib/apt/lists/*; \
	cpanm \
		EV \
		IO::Socket::IP \
		IO::Socket::Socks \
		Net::DNS::Native \
	; \
# the tests for IO::Socket::SSL like to hang... :(
	cpanm --notest IO::Socket::SSL; \
	apt-mark auto '.*' > /dev/null; \
	apt-mark manual $savedAptMark > /dev/null; \
	apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false

# https://metacpan.org/pod/release/SRI/Mojolicious-7.94/lib/Mojo/IOLoop.pm#DESCRIPTION
ENV LIBEV_FLAGS 4
# epoll (Linux)

# https://github.com/mojolicious/mojo/tags
# https://github.com/mojolicious/mojo/blob/main/Changes
RUN cpanm Mojolicious@8.73

# 复制脚本并赋予执行权限
COPY dockerhub-public-proxy.pl /usr/local/bin/
RUN chmod +x /usr/local/bin/dockerhub-public-proxy.pl

# 显式声明容器监听端口
EXPOSE 8080
# 启动时监听 0.0.0.0:8080
CMD ["/usr/local/bin/dockerhub-public-proxy.pl", "daemon", "-l", "http://0.0.0.0:8080"]