diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 new file mode 100644 index 00000000..a1b1d901 --- /dev/null +++ b/Dockerfile.arm64 @@ -0,0 +1,38 @@ +FROM jc21/nginx-proxy-manager-base:latest-arm64 + +MAINTAINER Jamie Curnow +LABEL maintainer="Jamie Curnow " + +ENV SUPPRESS_NO_CONFIG_WARNING=1 +ENV S6_FIX_ATTRS_HIDDEN=1 +RUN echo "fs.file-max = 65535" > /etc/sysctl.conf + +# Nginx, Node and required packages should already be installed from the base image + +# root filesystem +COPY rootfs / + +# s6 overlay +RUN curl -L -o /tmp/s6-overlay-aarch64.tar.gz "https://github.com/just-containers/s6-overlay/releases/download/v1.21.8.0/s6-overlay-aarch64.tar.gz" \ + && tar xzf /tmp/s6-overlay-aarch64.tar.gz -C / + +# App +ENV NODE_ENV=production + +ADD dist /app/dist +ADD node_modules /app/node_modules +ADD src/backend /app/src/backend +ADD package.json /app/package.json +ADD knexfile.js /app/knexfile.js + +# Volumes +VOLUME [ "/data", "/etc/letsencrypt" ] +CMD [ "/init" ] + +# Ports +EXPOSE 80 +EXPOSE 81 +EXPOSE 443 +EXPOSE 9876 + +HEALTHCHECK --interval=15s --timeout=3s CMD curl -f http://localhost:9876/health || exit 1 diff --git a/Jenkinsfile b/Jenkinsfile index 00639584..aa2d4967 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,12 +5,13 @@ pipeline { } agent any environment { - IMAGE_NAME = "nginx-proxy-manager" - BASE_IMAGE_NAME = "jc21/nginx-proxy-manager-base:latest" - TEMP_IMAGE_NAME = "nginx-proxy-manager-build_${BUILD_NUMBER}" - TEMP_IMAGE_NAME_ARM = "nginx-proxy-manager-arm-build_${BUILD_NUMBER}" - TAG_VERSION = getPackageVersion() - MAJOR_VERSION = "2" + IMAGE_NAME = "nginx-proxy-manager" + BASE_IMAGE_NAME = "jc21/nginx-proxy-manager-base:latest" + TEMP_IMAGE_NAME = "nginx-proxy-manager-build_${BUILD_NUMBER}" + TEMP_IMAGE_NAME_ARM = "nginx-proxy-manager-arm-build_${BUILD_NUMBER}" + TEMP_IMAGE_NAME_ARM64 = "nginx-proxy-manager-arm64-build_${BUILD_NUMBER}" + TAG_VERSION = getPackageVersion() + MAJOR_VERSION = "2" } stages { stage('Prepare') { @@ -144,6 +145,52 @@ pipeline { } } } + stage('arm64') { + when { + branch 'master' + } + agent { + label 'arm64' + } + steps { + ansiColor('xterm') { + // Codebase + sh 'docker run --rm -v $(pwd):/app -w /app $BASE_IMAGE_NAME-arm64 yarn install' + sh 'docker run --rm -v $(pwd):/app -w /app $BASE_IMAGE_NAME-arm64 npm run-script build' + sh 'rm -rf node_modules' + sh 'docker run --rm -v $(pwd):/app -w /app $BASE_IMAGE_NAME-arm64 yarn install --prod' + + // Docker Build + sh 'docker build --pull --no-cache --squash --compress -t $TEMP_IMAGE_NAME_ARM64 -f Dockerfile.arm64 .' + + // Dockerhub + sh 'docker tag $TEMP_IMAGE_NAME_ARM64 docker.io/jc21/$IMAGE_NAME:$TAG_VERSION-arm64' + sh 'docker tag $TEMP_IMAGE_NAME_ARM64 docker.io/jc21/$IMAGE_NAME:$MAJOR_VERSION-arm64' + sh 'docker tag $TEMP_IMAGE_NAME_ARM64 docker.io/jc21/$IMAGE_NAME:latest-arm64' + + withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) { + sh "docker login -u '${duser}' -p '$dpass'" + sh 'docker push docker.io/jc21/$IMAGE_NAME:$TAG_VERSION-arm64' + sh 'docker push docker.io/jc21/$IMAGE_NAME:$MAJOR_VERSION-arm64' + sh 'docker push docker.io/jc21/$IMAGE_NAME:latest-arm64' + } + + // Private Registry + sh 'docker tag $TEMP_IMAGE_NAME_ARM64 $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$TAG_VERSION-arm64' + sh 'docker tag $TEMP_IMAGE_NAME_ARM64 $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$MAJOR_VERSION-arm64' + sh 'docker tag $TEMP_IMAGE_NAME_ARM64 $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:latest-arm64' + + withCredentials([usernamePassword(credentialsId: 'jc21-private-registry', passwordVariable: 'dpass', usernameVariable: 'duser')]) { + sh "docker login -u '${duser}' -p '$dpass' $DOCKER_PRIVATE_REGISTRY" + sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$TAG_VERSION-arm64' + sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$MAJOR_VERSION-arm64' + sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:latest-arm64' + } + + sh 'docker rmi $TEMP_IMAGE_NAME_ARM64' + } + } + } } } }