diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 160721d..0000000 --- a/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -# alpine:3.13 -ARG REPO=microblink/java:17 -FROM $REPO AS base -ARG CRUSHFTP_VERSION=10.0.0_44 -ENV SOURCE_ZIP=/tmp/crushftp10.zip \ - CRUSHFTP_VERSION=$CRUSHFTP_VERSION - -FROM base AS deps -RUN apk upgrade --no-cache \ - && apk --no-cache add bash bash-completion bash-doc ca-certificates curl wget \ - && update-ca-certificates - -FROM deps AS source -ENV ORIGIN_SOURCE_ZIP=$SOURCE_ZIP -# source CrushFTP10.zip without java included -ARG SOURCE_ZIP=https://www.crushftp.com/early10/CrushFTP10.zip -ARG CRUSHFTP_VERSION=10.0.0_44 -ADD $SOURCE_ZIP /tmp/CrushFTP10.zip -# unzip to destination /tmp/CrushFTP10 -WORKDIR /tmp -RUN apk --no-cache add zip \ - && unzip -oq /tmp/CrushFTP10.zip -WORKDIR /src/tmp -RUN cd /tmp/CrushFTP10 \ - && zip -qr9 /src${ORIGIN_SOURCE_ZIP} * \ - && date '+%F %T %Z'>/src/tmp/__builddate.txt \ - && echo "CrushFTP Version = $CRUSHFTP_VERSION">>/src/tmp/__version.txt \ - && echo "Build Date Time = `cat /src/tmp/__builddate.txt`">>/src/tmp/__version.txt \ - && echo "Java = $JAVA_VERSION">>/src/tmp/__version.txt - -FROM source as build -ARG STARTUP=startup.sh -ADD $STARTUP /src/var/opt/startup.sh - -FROM deps as final -COPY --from=build /src / -WORKDIR /var/opt -ENTRYPOINT [ "/bin/bash", "startup.sh" ] -CMD ["-c"] - -ENV ADMIN_USER=crushadmin \ - ADMIN_PASSWORD= \ - WEB_PROTOCOL=http \ - WEB_PORT=8080 - -HEALTHCHECK --interval=1m --timeout=3s \ - CMD curl -f ${WEB_PROTOCOL}://localhost:${WEB_PORT}/favivon.ico -H 'Connection: close' || exit 1 - -ARG CRUSHFTP_VERSION=10.0.0_44 -VOLUME [ "/var/opt/crushftp" ] -EXPOSE 21 20000-20100 2222 443 8080 9090 -LABEL org.opencontainers.image.authors="https://github.com/NetLah" -LABEL org.opencontainers.image.url="https://hub.docker.com/r/netlah/crushftp" -LABEL org.opencontainers.image.source="https://github.com/NetLah/docker-crushftp" -LABEL org.opencontainers.image.version="$CRUSHFTP_VERSION" -LABEL org.opencontainers.image.description="CrushFTP 10 server on Alpine Linux 3.13 and OpenJDK 17." diff --git a/README.md b/README.md index 420af5e..7540434 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ CrushFTP 10 Server provides FTP, Implicit FTPS, SFTP, HTTP, or HTTPS ## Docker Specifications - Base: Alpine 3.13 Linux, OpenJDK 17, `microblink/java:17` -- CrushFTP 10 (v10.0.0_44) (required commercial license [pricing](https://www.crushftp.com/pricing.html)) +- CrushFTP 10 (v10.0.0_45) (required commercial license [pricing](https://www.crushftp.com/pricing.html)) This container [hub.docker.com/r/netlah/crushftp](hub.docker.com/r/netlah/crushftp) is distributed under the [MIT Licence](LICENSE). diff --git a/crushftp-source/Dockerfile b/crushftp-source/Dockerfile index 648d7af..736b054 100644 --- a/crushftp-source/Dockerfile +++ b/crushftp-source/Dockerfile @@ -1,5 +1,5 @@ # alpine:3.13 -# buildargs: REPO=alpine:3.13 CRUSHFTP_VERSION=10.0.0_44 SOURCE_METHOD=wget or add SOURCE_ZIP=https://www.crushftp.com/early10/CrushFTP10.zip +# buildargs: REPO=alpine:3.13 CRUSHFTP_VERSION=10.0.0_45 SOURCE_METHOD=wget or add SOURCE_ZIP=https://www.crushftp.com/early10/CrushFTP10.zip ARG REPO=alpine:3.13 ARG SOURCE_METHOD=wget @@ -33,11 +33,11 @@ FROM base as final WORKDIR /src COPY --from=zip /src . -ARG CRUSHFTP_VERSION=10.0.0_44 +ARG CRUSHFTP_VERSION=10.0.0_45 ENV CRUSHFTP_VERSION=$CRUSHFTP_VERSION -LABEL org.opencontainers.image.authors="https://github.com/NetLah" -LABEL org.opencontainers.image.url="https://hub.docker.com/r/netlah/crushftp-source" -LABEL org.opencontainers.image.source="https://github.com/NetLah/docker-crushftp" -LABEL org.opencontainers.image.description="Intermediate docker image for crushftp.zip." -LABEL org.opencontainers.image.version="$CRUSHFTP_VERSION" -LABEL version="$CRUSHFTP_VERSION" +LABEL org.opencontainers.image.authors="https://github.com/NetLah"\ + org.opencontainers.image.url="https://hub.docker.com/r/netlah/crushftp-source"\ + org.opencontainers.image.source="https://github.com/NetLah/docker-crushftp"\ + org.opencontainers.image.description="Intermediate docker image for crushftp.zip."\ + org.opencontainers.image.version="$CRUSHFTP_VERSION"\ + version="$CRUSHFTP_VERSION" diff --git a/crushftp-source/README.md b/crushftp-source/README.md index 0eaf837..2fbd981 100644 --- a/crushftp-source/README.md +++ b/crushftp-source/README.md @@ -5,7 +5,7 @@ This intermediate docker image contains crushftp.zip for next docker build image ## Docker Specifications - Base: Alpine 3.13 Linux -- CrushFTP 10 (v10.0.0_44) +- CrushFTP 10 (v10.0.0_45) - Repository: [hub.docker.com/r/netlah/crushftp](hub.docker.com/r/netlah/crushftp) - Docker: [hub.docker.com/r/netlah/crushftp-source](hub.docker.com/r/netlah/crushftp-source) diff --git a/crushftp-source/hooks/build b/crushftp-source/hooks/build index 120aa52..531c379 100644 --- a/crushftp-source/hooks/build +++ b/crushftp-source/hooks/build @@ -1,28 +1,54 @@ #!/bin/bash -echo "Current Dir: $(pwd)" -echo "SOURCE_BRANCH: ${SOURCE_BRANCH}" -echo "SOURCE_COMMIT: ${SOURCE_COMMIT}" -echo "COMMIT_MSG: ${COMMIT_MSG}" -echo "DOCKER_REPO: ${DOCKER_REPO}" -echo "DOCKERFILE_PATH: ${DOCKERFILE_PATH}" -echo "DOCKER_TAG: ${DOCKER_TAG}" -echo "IMAGE_NAME: ${IMAGE_NAME}" - IMAGE_NAME1="${DOCKER_REPO}:${SOURCE_COMMIT:0:7}" -DOCKER_BUID="DOCKER_BUILDKIT=1 docker build . -f $DOCKERFILE_PATH -t $IMAGE_NAME -t $IMAGE_NAME1" +IMAGE_DEV="${DOCKER_REPO}:dev" +IMAGE_LATEST="${DOCKER_REPO}:latest" + +cat <DOCKER_TAG: ${DOCKER_TAG}" + DOCKER_BUID="$DOCKER_BUID --build-arg CRUSHFTP_VERSION=$DOCKER_TAG" +fi + +echo "Docker build=> ${DOCKER_BUID}" eval $DOCKER_BUID ret_val=$? if [ ${ret_val} -eq 0 ]; then - echo "Pushing: ${IMAGE_NAME1} for ${SOURCE_COMMIT}" + echo "Pushing=> ${IMAGE_NAME1} for ${SOURCE_COMMIT}" docker push ${IMAGE_NAME1} else exit ret_val diff --git a/.dockerignore b/crushftp/.dockerignore similarity index 100% rename from .dockerignore rename to crushftp/.dockerignore diff --git a/crushftp/Dockerfile b/crushftp/Dockerfile new file mode 100644 index 0000000..ac1f1ba --- /dev/null +++ b/crushftp/Dockerfile @@ -0,0 +1,50 @@ +# alpine:3.13 +ARG REPO=microblink/java:17 +ARG CRUSHFTP_VERSION=10.0.0_45 +ARG SOURCE=netlah/crushftp-source:$CRUSHFTP_VERSION +FROM $REPO AS base + +FROM $SOURCE AS src + +FROM base as build +ARG STARTUP=startup.sh +ADD $STARTUP /src/var/opt/startup.sh +WORKDIR /src/tmp +COPY --from=src src/crushftp.zip . +ARG CRUSHFTP_VERSION=10.0.0_45 +RUN date '+%F %T %Z'>>__builddate.txt \ + && echo "CrushFTP Version = $CRUSHFTP_VERSION">>__version.txt \ + && echo "Build Date Time = `cat __builddate.txt`">>__version.txt \ + && echo "Java = $JAVA_VERSION">>__version.txt + +FROM base AS deps +RUN apk upgrade --no-cache \ + && apk --no-cache add bash bash-completion bash-doc ca-certificates curl wget \ + && update-ca-certificates + +FROM deps as final +COPY --from=build /src / +WORKDIR /var/opt +ENTRYPOINT [ "/bin/bash", "startup.sh" ] +CMD ["-c"] + +ARG CRUSHFTP_VERSION=10.0.0_45 +ENV ADMIN_USER=crushadmin \ + ADMIN_PASSWORD= \ + WEB_PROTOCOL=http \ + WEB_PORT=8080\ + SOURCE_ZIP=/tmp/crushftp.zip \ + CRUSHFTP_VERSION=$CRUSHFTP_VERSION + +HEALTHCHECK --interval=1m --timeout=3s \ + CMD curl -f ${WEB_PROTOCOL}://localhost:${WEB_PORT}/favicon.ico -H 'Connection: close' || exit 1 + +VOLUME [ "/var/opt/crushftp" ] +# remove range of Passive FTP 20000-20100 from declare +EXPOSE 21 2222 443 8080 9090 +LABEL org.opencontainers.image.authors="https://github.com/NetLah" \ + org.opencontainers.image.url="https://hub.docker.com/r/netlah/crushftp" \ + org.opencontainers.image.source="https://github.com/NetLah/docker-crushftp" \ + org.opencontainers.image.description="CrushFTP 10 server on Alpine Linux 3.13 and OpenJDK 17." \ + org.opencontainers.image.version="$CRUSHFTP_VERSION"\ + version="$CRUSHFTP_VERSION" diff --git a/crushftp/hooks/build b/crushftp/hooks/build new file mode 100644 index 0000000..c3f8e76 --- /dev/null +++ b/crushftp/hooks/build @@ -0,0 +1,56 @@ +#!/bin/bash + +IMAGE_NAME1="${DOCKER_REPO}:${SOURCE_COMMIT:0:7}" +IMAGE_DEV="${DOCKER_REPO}:dev" +IMAGE_LATEST="${DOCKER_REPO}:latest" + +cat <DOCKER_TAG: ${DOCKER_TAG}" + DOCKER_BUID="$DOCKER_BUID --build-arg CRUSHFTP_VERSION=$DOCKER_TAG" +fi + +if [[ -n "${SOURCE}" ]]; then + echo "-- SOURCE: ${SOURCE}" + DOCKER_BUID="$DOCKER_BUID --build-arg SOURCE=$SOURCE" +fi + +echo "Docker build=> ${DOCKER_BUID}" +eval $DOCKER_BUID + +ret_val=$? +if [ ${ret_val} -eq 0 ]; then + echo "Pushing=> ${IMAGE_NAME1} for ${SOURCE_COMMIT}" + docker push ${IMAGE_NAME1} +else + exit ret_val +fi diff --git a/startup.sh b/crushftp/startup.sh similarity index 95% rename from startup.sh rename to crushftp/startup.sh index b8b93e9..a769ded 100644 --- a/startup.sh +++ b/crushftp/startup.sh @@ -89,12 +89,17 @@ term_handler() { log "Stopping..." get_pid #echo "CRUSH_PID: $CRUSH_PID" + if [[ -z "$CRUSH_PID" ]]; then + log Cannot find PID + exit 1 + fi + log_n "Shutting down CrushFTP... " kill $CRUSH_PID ret_val=$? if [ ${ret_val} -ne 0 ]; then echo FAIL - log could not kill PID + log "Could not kill PID" exit 1 fi diff --git a/wget/Dockerfile b/wget/Dockerfile deleted file mode 100644 index aced713..0000000 --- a/wget/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -# alpine:3.13 -ARG REPO=microblink/java:17 -FROM $REPO AS base -ARG CRUSHFTP_VERSION=10.0.0_44 -ENV SOURCE_ZIP=/tmp/crushftp10.zip \ - CRUSHFTP_VERSION=$CRUSHFTP_VERSION - -FROM base AS deps -RUN apk upgrade --no-cache \ - && apk --no-cache add bash bash-completion bash-doc ca-certificates curl wget \ - && update-ca-certificates - -FROM deps AS source -ENV ORIGIN_SOURCE_ZIP=$SOURCE_ZIP -# source CrushFTP10.zip without java included -ARG SOURCE_ZIP=https://www.crushftp.com/early10/CrushFTP10.zip -ARG CRUSHFTP_VERSION=10.0.0_44 -# unzip to destination /tmp/CrushFTP10 -WORKDIR /tmp -RUN wget $SOURCE_ZIP \ - && apk --no-cache add zip \ - && unzip -oq /tmp/CrushFTP10.zip -WORKDIR /src/tmp -RUN cd /tmp/CrushFTP10 \ - && zip -qr9 /src${ORIGIN_SOURCE_ZIP} * \ - && date '+%F %T %Z'>/src/tmp/__builddate.txt \ - && echo "CrushFTP Version = $CRUSHFTP_VERSION">>/src/tmp/__version.txt \ - && echo "Build Date Time = `cat /src/tmp/__builddate.txt`">>/src/tmp/__version.txt \ - && echo "Java = $JAVA_VERSION">>/src/tmp/__version.txt - -FROM source as build -ARG STARTUP=startup.sh -ADD $STARTUP /src/var/opt/startup.sh - -FROM deps as final -COPY --from=build /src / -WORKDIR /var/opt -ENTRYPOINT [ "/bin/bash", "startup.sh" ] -CMD ["-c"] - -ENV ADMIN_USER=crushadmin \ - ADMIN_PASSWORD= \ - WEB_PROTOCOL=http \ - WEB_PORT=8080 - -HEALTHCHECK --interval=1m --timeout=3s \ - CMD curl -f ${WEB_PROTOCOL}://localhost:${WEB_PORT}/favivon.ico -H 'Connection: close' || exit 1 - -ARG CRUSHFTP_VERSION=10.0.0_44 -VOLUME [ "/var/opt/crushftp" ] -EXPOSE 21 20000-20100 2222 443 8080 9090 -LABEL org.opencontainers.image.authors="https://github.com/NetLah" -LABEL org.opencontainers.image.url="https://hub.docker.com/r/netlah/crushftp" -LABEL org.opencontainers.image.source="https://github.com/NetLah/docker-crushftp" -LABEL org.opencontainers.image.version="$CRUSHFTP_VERSION" -LABEL org.opencontainers.image.description="CrushFTP 10 server on Alpine Linux 3.13 and OpenJDK 17."