Skip to content

Commit

Permalink
Update v10.0.0_45; use docker-crushftp; update hooks; move to subfolder
Browse files Browse the repository at this point in the history
  • Loading branch information
thohng committed Aug 28, 2021
1 parent ca19c49 commit f93a09c
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 136 deletions.
56 changes: 0 additions & 56 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
16 changes: 8 additions & 8 deletions crushftp-source/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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"
2 changes: 1 addition & 1 deletion crushftp-source/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
52 changes: 39 additions & 13 deletions crushftp-source/hooks/build
Original file line number Diff line number Diff line change
@@ -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 <<EOF
Current Dir: ${PWD}
SOURCE_BRANCH: ${SOURCE_BRANCH}
SOURCE_COMMIT: ${SOURCE_COMMIT}
COMMIT_MSG: ${COMMIT_MSG}
DOCKER_REPO: ${DOCKER_REPO}
DOCKERFILE_PATH: ${DOCKERFILE_PATH}
DOCKER_TAG: ${DOCKER_TAG}
IMAGE_NAME: ${IMAGE_NAME}
IMAGE_NAME1: ${IMAGE_NAME1}
IMAGE_DEV: ${IMAGE_DEV}
IMAGE_LATEST: ${IMAGE_LATEST}
EOF

DOCKER_BUID="DOCKER_BUILDKIT=1 docker build . -f $DOCKERFILE_PATH -t $IMAGE_NAME -t $IMAGE_NAME1 --cache-from=$IMAGE_DEV --cache-from=$IMAGE_LATEST"

if [[ ! -z "${REPO}" ]]; then
if [[ -n "${REPO}" ]]; then
echo "-- REPO: ${REPO}"
DOCKER_BUID="$DOCKER_BUID --build-arg REPO=$REPO"
fi

echo "Docker build: ${DOCKER_BUID}"
if [[ -n "${SOURCE_METHOD}" ]]; then
echo "-- SOURCE_METHOD: ${SOURCE_METHOD}"
DOCKER_BUID="$DOCKER_BUID --build-arg SOURCE_METHOD=$SOURCE_METHOD"
fi

if [[ -n "${SOURCE_ZIP}" ]]; then
echo "-- SOURCE_ZIP: ${SOURCE_ZIP}"
DOCKER_BUID="$DOCKER_BUID --build-arg SOURCE_ZIP=$SOURCE_ZIP"
fi

if [[ -n "${CRUSHFTP_VERSION}" ]]; then
echo "-- CRUSHFTP_VERSION: ${CRUSHFTP_VERSION}"
DOCKER_BUID="$DOCKER_BUID --build-arg CRUSHFTP_VERSION=$CRUSHFTP_VERSION"
elif [[ "${DOCKER_TAG}" =~ ^[0-9]+(.[0-9]+){0,3}(_[0-9]+)?$ ]] ; then
echo "-- CRUSHFTP_VERSION->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
Expand Down
File renamed without changes.
50 changes: 50 additions & 0 deletions crushftp/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"
56 changes: 56 additions & 0 deletions crushftp/hooks/build
Original file line number Diff line number Diff line change
@@ -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 <<EOF
Current Dir: ${PWD}
SOURCE_BRANCH: ${SOURCE_BRANCH}
SOURCE_COMMIT: ${SOURCE_COMMIT}
COMMIT_MSG: ${COMMIT_MSG}
DOCKER_REPO: ${DOCKER_REPO}
DOCKERFILE_PATH: ${DOCKERFILE_PATH}
DOCKER_TAG: ${DOCKER_TAG}
IMAGE_NAME: ${IMAGE_NAME}
IMAGE_NAME1: ${IMAGE_NAME1}
IMAGE_DEV: ${IMAGE_DEV}
IMAGE_LATEST: ${IMAGE_LATEST}
EOF

if [[ "$DOCKERFILE_PATH" = "Dockerfile" ]]; then
cp ../README.md .
else
cp README.md crushftp/
fi

DOCKER_BUID="DOCKER_BUILDKIT=1 docker build . -f $DOCKERFILE_PATH -t $IMAGE_NAME -t $IMAGE_NAME1 --cache-from=$IMAGE_DEV --cache-from=$IMAGE_LATEST"

if [[ -n "${REPO}" ]]; then
echo "-- REPO: ${REPO}"
DOCKER_BUID="$DOCKER_BUID --build-arg REPO=$REPO"
fi

if [[ -n "${CRUSHFTP_VERSION}" ]]; then
echo "-- CRUSHFTP_VERSION: ${CRUSHFTP_VERSION}"
DOCKER_BUID="$DOCKER_BUID --build-arg CRUSHFTP_VERSION=$CRUSHFTP_VERSION"
elif [[ "${DOCKER_TAG}" =~ ^[0-9]+(.[0-9]+){0,3}(_[0-9]+)?$ ]] ; then
echo "-- CRUSHFTP_VERSION->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
7 changes: 6 additions & 1 deletion startup.sh → crushftp/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
56 changes: 0 additions & 56 deletions wget/Dockerfile

This file was deleted.

0 comments on commit f93a09c

Please sign in to comment.