FROM alpine:latest # Install vsftpd and netcat for healthcheck RUN apk update && \ apk add --no-cache vsftpd netcat-openbsd && \ rm -rf /var/cache/apk/* # Create FTP directory for anonymous users and log directory RUN mkdir -p /var/ftp/pub /var/log && \ chmod 755 /var/ftp/pub && \ chown ftp:ftp /var/ftp/pub && \ touch /var/log/xferlog /var/log/vsftpd.log && \ chmod 666 /var/log/xferlog /var/log/vsftpd.log # Create a test file for anonymous downloads COPY welcome.txt /var/ftp/pub/welcome.txt RUN chown ftp:ftp /var/ftp/pub/welcome.txt # Configure vsftpd for anonymous access COPY vsftpd.conf /etc/vsftpd/vsftpd.conf # Expose FTP port and passive mode ports EXPOSE 21 21100-21110 # Start vsftpd in foreground mode and tail logs to stdout CMD sh -c "vsftpd /etc/vsftpd/vsftpd.conf & tail -f /var/log/xferlog /var/log/vsftpd.log 2>/dev/null & wait"