forked from stilliard/docker-pure-ftpd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
62 lines (49 loc) · 2.22 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
FROM debian:stretch
# feel free to change this ;)
LABEL maintainer "Andrew Stilliard <[email protected]>"
# properly setup debian sources
ENV DEBIAN_FRONTEND noninteractive
RUN echo "deb http://http.debian.net/debian stretch main\n\
deb-src http://http.debian.net/debian stretch main\n\
deb http://http.debian.net/debian stretch-updates main\n\
deb-src http://http.debian.net/debian stretch-updates main\n\
deb http://security.debian.org stretch/updates main\n\
deb-src http://security.debian.org stretch/updates main\n\
" > /etc/apt/sources.list
# install package building helpers
# rsyslog for logging (ref https://github.com/stilliard/docker-pure-ftpd/issues/17)
RUN apt-get -y update && \
apt-get -y --force-yes --fix-missing install dpkg-dev debhelper &&\
apt-get -y build-dep pure-ftpd &&\
apt-get -y install openbsd-inetd rsyslog
# build from source to add --without-capabilities flag
RUN mkdir /tmp/pure-ftpd/ && \
cd /tmp/pure-ftpd/ && \
apt-get source pure-ftpd && \
cd pure-ftpd-* && \
./configure --with-tls | grep -v '^checking' | grep -v ': Entering directory' | grep -v ': Leaving directory' && \
sed -i '/^optflags=/ s/$/ --without-capabilities/g' ./debian/rules && \
dpkg-buildpackage -b -uc | grep -v '^checking' | grep -v ': Entering directory' | grep -v ': Leaving directory'
# install the new deb files
RUN dpkg -i /tmp/pure-ftpd/pure-ftpd-common*.deb &&\
dpkg -i /tmp/pure-ftpd/pure-ftpd_*.deb
# Prevent pure-ftpd upgrading
RUN apt-mark hold pure-ftpd pure-ftpd-common
# setup ftpgroup and ftpuser
RUN groupadd ftpgroup &&\
useradd -g ftpgroup -d /home/ftpusers -s /dev/null ftpuser
# configure rsyslog logging
RUN echo "" >> /etc/rsyslog.conf && \
echo "#PureFTP Custom Logging" >> /etc/rsyslog.conf && \
echo "ftp.* /var/log/pure-ftpd/pureftpd.log" >> /etc/rsyslog.conf && \
echo "Updated /etc/rsyslog.conf with /var/log/pure-ftpd/pureftpd.log"
# setup run/init file
COPY run.sh /run.sh
RUN chmod u+x /run.sh
# default publichost, you'll need to set this for passive support
ENV PUBLICHOST localhost
# couple available volumes you may want to use
VOLUME ["/home/ftpusers", "/etc/pure-ftpd/passwd"]
# startup
CMD /run.sh -c 5 -C 5 -l puredb:/etc/pure-ftpd/pureftpd.pdb -E -j -R -P $PUBLICHOST
EXPOSE 21 30000-30009