-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from sbesson/alpine_3.15.0
Alpine 3.15.0
- Loading branch information
Showing
9 changed files
with
103 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
name: Build | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
env: | ||
IMAGE_NAME: openmicroscopy/vsftpd-anonymous-upload | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Test | ||
run: ./test.sh | ||
# Push image to DockerHub | ||
push: | ||
needs: build | ||
|
||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Build image | ||
run: docker build . --file Dockerfile --tag $IMAGE_NAME | ||
|
||
- name: Log into registry | ||
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u omereleases --password-stdin | ||
|
||
- name: Push image | ||
run: | | ||
# Strip git ref prefix from version | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
# Strip "v" prefix from tag name | ||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | ||
# Use Docker `latest` tag convention | ||
[ "$VERSION" == "master" ] && VERSION=latest | ||
echo IMAGE_NAME=$IMAGE_NAME | ||
echo VERSION=$VERSION | ||
docker tag $IMAGE_NAME $IMAGE_NAME:$VERSION | ||
docker push $IMAGE_NAME:$VERSION |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,11 @@ | |
# Dockerfile for vsftpd | ||
# | ||
|
||
FROM alpine:3.7 | ||
FROM alpine:3.15.0 | ||
MAINTAINER [email protected] | ||
|
||
RUN set -xe \ | ||
&& apk add -U vsftpd \ | ||
&& passwd -l root \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
ADD vsftpd.conf vsftpd.email_passwords vsftpd.banner /etc/vsftpd/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
version: "3" | ||
|
||
services: | ||
ftpserver: | ||
build: . | ||
restart: on-failure | ||
ftpclient: | ||
build: ftpclient | ||
tty: true | ||
depends_on: | ||
- "ftpserver" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM alpine:latest | ||
|
||
RUN apk --no-cache add lftp ca-certificates openssh | ||
|
||
COPY generate.sh /tmp/generate.sh | ||
WORKDIR /data | ||
RUN sh /tmp/generate.sh | ||
|
||
ENTRYPOINT ["lftp"] | ||
CMD ["-f", "/tmp/upload.scp", "-d"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#! /bin/sh | ||
N=${N:-10000} | ||
THREADS=${THREADS:-10} | ||
USER=${USER:-anonymous} | ||
PASS=${PASS:-allowed@example.org} | ||
SERVER=${SERVER:-ftpserver} | ||
|
||
# Create data and checksum | ||
mkdir -p /tmp/test && cd /tmp/test | ||
for i in $(seq 1 $N); do | ||
echo $date-$i > $i | ||
done | ||
find * -type f -exec sha1sum {} \; | grep -v SHASUMS > SHASUMS | ||
|
||
# Generate upload script | ||
echo "open -u $USER,$PASS $SERVER" > /tmp/upload.scp | ||
echo "mkdir /incoming/parallel" >> /tmp/upload.scp | ||
echo "set ftp:use-site-utime false" >> /tmp/upload.scp | ||
echo "set ftp:use-site-utime2 false" >> /tmp/upload.scp | ||
echo "mirror -p --parallel=$THREADS -R /tmp/test/ /incoming/test/" >> /tmp/upload.scp | ||
echo "bye" >> /tmp/upload.scp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,22 +2,9 @@ | |
|
||
set -eu | ||
|
||
docker rm -f test-vsftpd || true | ||
docker build -t vsftpd-anonymous-upload-docker . | ||
docker run -d --rm --name test-vsftpd -p 32021:21 -p 32022-32041:32022-32041 vsftpd-anonymous-upload-docker | ||
sleep 5 | ||
docker-compose down | ||
docker-compose build | ||
docker-compose up -d | ||
docker wait vsftpd-anonymous-upload-docker_ftpclient_1 | ||
docker exec vsftpd-anonymous-upload-docker_ftpserver_1 sh -c "cd incoming/test && sha1sum -c SHASUMS" | ||
|
||
# Note ftp returns exit code 0 even if an error occurred | ||
ftp -n localhost 32021 << EOF | ||
user anonymous [email protected] | ||
passive | ||
cd incoming | ||
put test.sh | ||
quit | ||
EOF | ||
|
||
docker logs test-vsftpd | ||
|
||
CHECK=$(docker exec test-vsftpd find /var/lib/ftp/incoming | tr '\n' ' ') | ||
test "$CHECK" = '/var/lib/ftp/incoming /var/lib/ftp/incoming/test.sh ' | ||
docker rm -f test-vsftpd |