-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
55 lines (47 loc) · 2.15 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
# ------------------------------------------------------------------------------
# Pull base image
FROM debian:bullseye-slim
MAINTAINER Brett Kuskie <fullaxx@gmail.com>
# ------------------------------------------------------------------------------
# Set environment variables
ENV DEBIAN_FRONTEND noninteractive
# ------------------------------------------------------------------------------
# Install vsftpd and clean up
RUN apt-get update && \
apt-get install -y --no-install-recommends vsftpd && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/*
# ------------------------------------------------------------------------------
# Configure vsftpd for anonymous read-only transfers in PASV mode
RUN mkdir /log && \
sed \
-e 's/anonymous_enable=NO/anonymous_enable=YES/' \
-e 's/local_enable=YES/local_enable=NO/' \
-e 's/#write_enable=YES/write_enable=NO/' \
-e 's/#anon_upload_enable=YES/anon_upload_enable=NO/' \
-e 's/#anon_mkdir_write_enable=YES/anon_mkdir_write_enable=NO/' \
-e 's/#nopriv_user=ftpsecure/nopriv_user=ftp/' \
-e 's@#xferlog_file=/var/log/vsftpd.log@xferlog_file=/log/xfer.log@' \
-i /etc/vsftpd.conf && \
echo >> /etc/vsftpd.conf && \
echo "vsftpd_log_file=/log/vsftpd.log" >> /etc/vsftpd.conf && \
echo "no_anon_password=YES" >> /etc/vsftpd.conf && \
echo "pasv_enable=YES" >> /etc/vsftpd.conf && \
echo "pasv_min_port=PASVMINPORT" >> /etc/vsftpd.conf && \
echo "pasv_max_port=PASVMAXPORT" >> /etc/vsftpd.conf
# This appears to be unnecessary on x86_64
# echo "seccomp_sandbox=no" >> /etc/vsftpd.conf
# ------------------------------------------------------------------------------
# Install startup script with dockerwait
# https://github.com/Fullaxx/dockerwait
COPY app.sh dockerwait.static /app/
# ------------------------------------------------------------------------------
# Identify Volumes
VOLUME /srv/ftp
VOLUME /log
# ------------------------------------------------------------------------------
# Expose ports
EXPOSE 21
# ------------------------------------------------------------------------------
# Define runtime command
CMD ["/app/app.sh"]