-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
106 lines (93 loc) · 2.98 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
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
# https://hub.docker.com/_/alpine
FROM alpine:3.21
ARG pure_ftpd_ver=1.0.52
ARG s6_overlay_ver=3.2.0.2
ARG build_rev=2
# Build and install Pure-FTPd
RUN apk update \
&& apk upgrade \
&& apk add --no-cache \
ca-certificates \
&& update-ca-certificates \
\
# Install Pure-FTPd dependencies
&& apk add --no-cache \
libretls \
libsodium \
\
# Install tools for building
&& apk add --no-cache --virtual .tool-deps \
curl coreutils autoconf g++ libtool make \
\
# Install Pure-FTPd build dependencies
&& apk add --no-cache --virtual .build-deps \
libretls-dev \
libsodium-dev \
\
# Download and prepare Pure-FTPd sources
&& curl -fL -o /tmp/pure-ftpd.tar.gz \
https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${pure_ftpd_ver}.tar.gz \
&& (echo "d3aa87e0e9beca464f5dc23ea86835ba42a8bb57120e8c0a4cd975925aed850a442766c1ef605e563d6c61a37967b4f283ababb991493327ce6f0a1749aae01a /tmp/pure-ftpd.tar.gz" \
| sha512sum -c -) \
&& tar -xzf /tmp/pure-ftpd.tar.gz -C /tmp/ \
&& cd /tmp/pure-ftpd-* \
\
# Build Pure-FTPd from sources
&& ./configure --prefix=/usr \
--with-peruserlimits \
--with-puredb \
--with-quotas \
--with-ratios \
--with-rfc2640 \
--with-throttling \
--with-tls \
--without-capabilities \
--without-humor \
--without-inetd \
--without-usernames \
&& make \
\
# Create Pure-FTPd user and groups
&& addgroup -S -g 91 pure-ftpd \
&& adduser -S -u 90 -D -s /sbin/nologin \
-H -h /data \
-G pure-ftpd -g pure-ftpd \
pure-ftpd \
\
# Install and configure Pure-FTPd
&& make install \
&& install -d -o pure-ftpd -g pure-ftpd /data \
# Disable daemonization
&& sed -i -e 's,^Daemonize .*,Daemonize no,' \
/etc/pure-ftpd.conf \
# No documentation included to keep image size smaller
&& rm -rf /usr/share/man/* \
\
# Cleanup unnecessary stuff
&& apk del .tool-deps .build-deps \
&& rm -rf /var/cache/apk/* \
/tmp/*
# Install s6-overlay
RUN apk add --update --no-cache --virtual .tool-deps \
curl \
&& curl -fL -o /tmp/s6-overlay-noarch.tar.xz \
https://github.com/just-containers/s6-overlay/releases/download/v${s6_overlay_ver}/s6-overlay-noarch.tar.xz \
&& curl -fL -o /tmp/s6-overlay-bin.tar.xz \
https://github.com/just-containers/s6-overlay/releases/download/v${s6_overlay_ver}/s6-overlay-x86_64.tar.xz \
&& tar -xf /tmp/s6-overlay-noarch.tar.xz -C / \
&& tar -xf /tmp/s6-overlay-bin.tar.xz -C / \
\
# Cleanup unnecessary stuff
&& apk del .tool-deps \
&& rm -rf /var/cache/apk/* \
/tmp/*
ENV S6_KEEP_ENV=1 \
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
S6_CMD_WAIT_FOR_SERVICES=1 \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=5000
COPY rootfs /
RUN chmod +x /etc/s6-overlay/s6-rc.d/*/run \
/etc/s6-overlay/s6-rc.d/*/*.sh
EXPOSE 21 30000-30009
ENTRYPOINT ["/init"]
CMD ["pure-ftpd", "/etc/pure-ftpd.conf"]