Skip to content

Commit

Permalink
Add Dockerfile for repos crushftp-source
Browse files Browse the repository at this point in the history
  • Loading branch information
thohng committed Aug 28, 2021
1 parent 456588f commit ca19c49
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 0 deletions.
26 changes: 26 additions & 0 deletions crushftp-source/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
**/dist
LICENSE
README.md
43 changes: 43 additions & 0 deletions crushftp-source/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 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
ARG REPO=alpine:3.13
ARG SOURCE_METHOD=wget

FROM $REPO AS base

FROM base AS base-source
RUN apk upgrade --no-cache \
&& apk --no-cache add ca-certificates curl wget zip
WORKDIR /tmp

FROM base-source AS source-wget
# source CrushFTP10.zip without java included
ARG SOURCE_ZIP=https://www.crushftp.com/early10/CrushFTP10.zip
RUN wget -q -O CrushFTP10.zip $SOURCE_ZIP

FROM base-source AS source-add
# source CrushFTP10.zip without java included
ARG SOURCE_ZIP=https://www.crushftp.com/early10/CrushFTP10.zip
ADD $SOURCE_ZIP CrushFTP10.zip

FROM source-$SOURCE_METHOD AS zip
# unzip to destination /tmp/CrushFTP10
RUN unzip -oq CrushFTP10.zip
# create folder /src if not exist
WORKDIR /src
RUN cd /tmp/CrushFTP10 \
&& zip -qr9 /src/crushftp.zip * \
&& date '+%F %T %z'>/src/__builddate.txt

FROM base as final
WORKDIR /src
COPY --from=zip /src .

ARG CRUSHFTP_VERSION=10.0.0_44
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"
16 changes: 16 additions & 0 deletions crushftp-source/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# CrushFTP 10 Source

This intermediate docker image contains crushftp.zip for next docker build image Crushftp server.

## Docker Specifications

- Base: Alpine 3.13 Linux
- CrushFTP 10 (v10.0.0_44)
- 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)

## Content

```
/src/crushftp.zip
```
29 changes: 29 additions & 0 deletions crushftp-source/hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/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"

if [[ ! -z "${REPO}" ]]; then
echo "-- REPO: ${REPO}"
DOCKER_BUID="$DOCKER_BUID --build-arg REPO=$REPO"
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

0 comments on commit ca19c49

Please sign in to comment.