commit f4289fa2dbe4f44c254b35e6492fd643ecd96f7b Author: Gareth Flowers Date: Fri Jul 10 17:27:43 2020 +0100 feat(): initial version diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2e9d890 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM alpine:3.12 + +ENV FTP_USER=foo \ + FTP_PASS=bar + +RUN apk add --no-cache --update \ + vsftpd==3.0.3-r6 + +COPY [ "/vsftpd.conf", "/etc" ] +COPY [ "/docker-entrypoint.sh", "/" ] + +CMD [ "/usr/sbin/vsftpd" ] +ENTRYPOINT [ "/docker-entrypoint.sh" ] +EXPOSE 21 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..88c82d7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Gareth Flowers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e8f63b7 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# FTP Server + +A simple FTP server, using `vsftpd`. + +## How to use this image + +### Start a FTP Server instance + +To start a container, with data stored in `/data` on the host, use the following: +```sh +docker run \ + --name my-ftp-server \ + --detach \ + --env FTP_USER=user \ + --env FTP_PASS=123 \ + --volume /data:/home/user \ + --publish 21:21 \ + garethflowers/ftp-server +``` + +## License + +* This image is released under the [MIT License](https://raw.githubusercontent.com/garethflowers/docker-ftp-server/master/LICENSE). diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..8acdd82 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.0.1 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..f7fca7b --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +addgroup \ + -S \ + $FTP_USER + +adduser \ + -D \ + -G $FTP_USER \ + -h /home/$FTP_USER \ + -s /bin/false \ + $FTP_USER + +mkdir -p /home/$FTP_USER +chown -R $FTP_USER:$FTP_USER /home/$FTP_USER +echo "$FTP_USER:$FTP_PASS" | /usr/sbin/chpasswd + +exec "$@" diff --git a/vsftpd.conf b/vsftpd.conf new file mode 100644 index 0000000..c1fd27d --- /dev/null +++ b/vsftpd.conf @@ -0,0 +1,16 @@ +anonymous_enable=NO +allow_writeable_chroot=YES +background=NO +chroot_local_user=YES +dirmessage_enable=YES +listen_ipv6=NO +local_enable=YES +local_umask=022 +max_clients=10 +max_per_ip=5 +passwd_chroot_enable=yes +pasv_max_port=50000 +pasv_min_port=40000 +pasv_enable=Yes +seccomp_sandbox=NO +write_enable=YES