Add a Dockerfile for local test runs

This commit is contained in:
Brian Foshee 2016-03-01 10:18:35 -05:00
parent 025815df64
commit 9b02ca7de8
2 changed files with 43 additions and 0 deletions

36
Dockerfile Normal file
View File

@ -0,0 +1,36 @@
FROM golang:1.6.0
RUN mkdir --mode 0777 -p /var/ftp/incoming
RUN mkdir -p /var/run/vsftpd/empty
RUN mkdir -p $GOPATH/src/github.com/jlaffaye/ftp
WORKDIR $GOPATH/src/github.com/jlaffaye/ftp
RUN go get github.com/axw/gocov/gocov
RUN go get github.com/mattn/goveralls
RUN apt-get update && apt-get install -y --no-install-recommends vsftpd && apt-get clean
RUN echo "local_enable=YES" >> /etc/vsftpd.conf && \
echo "anon_root=/var/ftp" >> /etc/vsftpd.conf && \
echo "anon_upload_enable=YES" >> /etc/vsftpd.conf && \
echo "anonymous_enable=YES" >> /etc/vsftpd.conf && \
echo "dirmessage_enable=YES" >> /etc/vsftpd.conf && \
echo "anon_umask=022" >> /etc/vsftpd.conf && \
echo "anon_mkdir_write_enable=YES" >> /etc/vsftpd.conf && \
echo "anon_other_write_enable=YES" >> /etc/vsftpd.conf && \
echo "secure_chroot_dir=/var/run/vsftpd/empty" >> /etc/vsftpd.conf && \
echo "listen_ipv6=YES" >> /etc/vsftpd.conf && \
echo "chroot_local_user=YES" >> /etc/vsftpd.conf && \
echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf && \
echo "write_enable=YES" >> /etc/vsftpd.conf && \
echo "background=YES" >> /etc/vsftpd.conf && \
echo "local_umask=022" >> /etc/vsftpd.conf && \
echo "#!/bin/sh" >> test.sh && \
echo "vsftpd /etc/vsftpd.conf" >> test.sh && \
echo "go test" >> test.sh && \
chmod +x test.sh
COPY ./ .
CMD ["./test.sh"]

View File

@ -15,3 +15,10 @@ go get -u github.com/jlaffaye/ftp
## Documentation ##
http://godoc.org/github.com/jlaffaye/ftp
## Testing ##
```
docker build -t ftp-go .`
docker run --rm ftp-go
```