diff --git a/Dockerfile b/Dockerfile index 9452a8d..951b58e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ FROM lsiobase/alpine:3.8 # set version label ARG BUILD_DATE ARG VERSION +ARG DUCKDNS_VERSION LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="aptalca" diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 new file mode 100644 index 0000000..5a5ec16 --- /dev/null +++ b/Dockerfile.aarch64 @@ -0,0 +1,22 @@ +FROM lsiobase/alpine.arm64:3.8 + +# Add qemu to run on x86_64 systems +COPY qemu-aarch64-static /usr/bin + +# set version label +ARG BUILD_DATE +ARG VERSION +ARG DUCKDNS_VERSION +LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" +LABEL maintainer="aptalca" + +# environment settings +ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2 + +RUN \ + echo "**** install packages ****" && \ + apk add --no-cache \ + curl + +# add local files +COPY root/ / diff --git a/Dockerfile.armhf b/Dockerfile.armhf new file mode 100644 index 0000000..df1a02a --- /dev/null +++ b/Dockerfile.armhf @@ -0,0 +1,22 @@ +FROM lsiobase/alpine.armhf:3.8 + +# Add qemu to run on x86_64 systems +COPY qemu-arm-static /usr/bin + +# set version label +ARG BUILD_DATE +ARG VERSION +ARG DUCKDNS_VERSION +LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" +LABEL maintainer="aptalca" + +# environment settings +ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2 + +RUN \ + echo "**** install packages ****" && \ + apk add --no-cache \ + curl + +# add local files +COPY root/ / diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..0f5499c --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,474 @@ +pipeline { + agent { + label 'X86-64-MULTI' + } + // Configuration for the variables used for this specific repo + environment { + BUILD_VERSION_ARG = 'DUCKDNS_VERSION' + LS_USER = 'linuxserver' + LS_REPO = 'docker-duckdns' + CONTAINER_NAME = 'duckdns' + DOCKERHUB_IMAGE = 'linuxserver/duckdns' + DEV_DOCKERHUB_IMAGE = 'lsiodev/duckdns' + PR_DOCKERHUB_IMAGE = 'lspipepr/duckdns' + BUILDS_DISCORD = credentials('build_webhook_url') + GITHUB_TOKEN = credentials('498b4638-2d02-4ce5-832d-8a57d01d97ab') + DIST_IMAGE = 'alpine' + DIST_TAG = '3.8' + DIST_PACKAGES = 'curl' + MULTIARCH='true' + CI='true' + CI_WEB='false' + CI_PORT='' + CI_SSL='' + CI_DELAY='5' + CI_DOCKERENV='SUBDOMAINS=testing|TOKEN=testing' + CI_AUTH='' + CI_WEBPATH='' + } + stages { + // Setup all the basic environment variables needed for the build + stage("Set ENV Variables base"){ + steps{ + script{ + env.LS_RELEASE = sh( + script: '''curl -s https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases/latest | jq -r '. | .tag_name' ''', + returnStdout: true).trim() + env.LS_RELEASE_NOTES = sh( + script: '''git log -1 --pretty=%B | sed -E ':a;N;$!ba;s/\\r{0,1}\\n/\\\\n/g' ''', + returnStdout: true).trim() + env.GITHUB_DATE = sh( + script: '''date '+%Y-%m-%dT%H:%M:%S%:z' ''', + returnStdout: true).trim() + env.COMMIT_SHA = sh( + script: '''git rev-parse HEAD''', + returnStdout: true).trim() + env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/commit/' + env.GIT_COMMIT + env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/' + env.PULL_REQUEST = env.CHANGE_ID + } + script{ + env.LS_RELEASE_NUMBER = sh( + script: '''echo ${LS_RELEASE} |sed 's/^.*-ls//g' ''', + returnStdout: true).trim() + } + script{ + env.LS_TAG_NUMBER = sh( + script: '''#! /bin/bash + tagsha=$(git rev-list -n 1 ${LS_RELEASE} 2>/dev/null) + if [ "${tagsha}" == "${COMMIT_SHA}" ]; then + echo ${LS_RELEASE_NUMBER} + elif [ -z "${GIT_COMMIT}" ]; then + echo ${LS_RELEASE_NUMBER} + else + echo $((${LS_RELEASE_NUMBER} + 1)) + fi''', + returnStdout: true).trim() + } + } + } + /* ####################### + Package Version Tagging + ####################### */ + // If this is an alpine base image determine the base package tag to use + stage("Set Package tag Alpine"){ + steps{ + sh '''docker pull alpine:${DIST_TAG}''' + script{ + env.PACKAGE_TAG = sh( + script: '''docker run --rm alpine:${DIST_TAG} sh -c 'apk update --quiet\ + && apk info '"${DIST_PACKAGES}"' | md5sum | cut -c1-8' ''', + returnStdout: true).trim() + } + } + } + /* ######################## + External Release Tagging + ######################## */ + // If this is an os release set release type to none to indicate no external release + stage("Set ENV os"){ + steps{ + script{ + env.EXT_RELEASE = env.PACKAGE_TAG + env.RELEASE_LINK = 'none' + } + } + } + // If this is a master build use live docker endpoints + stage("Set ENV live build"){ + when { + branch "master" + environment name: 'CHANGE_ID', value: '' + } + steps { + script{ + env.IMAGE = env.DOCKERHUB_IMAGE + if (env.MULTIARCH == 'true') { + env.CI_TAGS = 'amd64-' + env.EXT_RELEASE + '-ls' + env.LS_TAG_NUMBER + '|arm32v6-' + env.EXT_RELEASE + '-ls' + env.LS_TAG_NUMBER + '|arm64v8-' + env.EXT_RELEASE + '-ls' + env.LS_TAG_NUMBER + } else { + env.CI_TAGS = env.EXT_RELEASE + '-ls' + env.LS_TAG_NUMBER + } + env.META_TAG = env.EXT_RELEASE + '-ls' + env.LS_TAG_NUMBER + } + } + } + // If this is a dev build use dev docker endpoints + stage("Set ENV dev build"){ + when { + not {branch "master"} + environment name: 'CHANGE_ID', value: '' + } + steps { + script{ + env.IMAGE = env.DEV_DOCKERHUB_IMAGE + if (env.MULTIARCH == 'true') { + env.CI_TAGS = 'amd64-' + env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA + '|arm32v6-' + env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA + '|arm64v8-' + env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA + } else { + env.CI_TAGS = env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA + } + env.META_TAG = env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA + env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DEV_DOCKERHUB_IMAGE + '/tags/' + } + } + } + // If this is a pull request build use dev docker endpoints + stage("Set ENV PR build"){ + when { + not {environment name: 'CHANGE_ID', value: ''} + } + steps { + script{ + env.IMAGE = env.PR_DOCKERHUB_IMAGE + if (env.MULTIARCH == 'true') { + env.CI_TAGS = 'amd64-' + env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST + '|arm32v6-' + env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST + '|arm64v8-' + env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST + } else { + env.CI_TAGS = env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST + } + env.META_TAG = env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST + env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/pull/' + env.PULL_REQUEST + env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.PR_DOCKERHUB_IMAGE + '/tags/' + } + } + } + // Use helper container to render a readme from the template if needed + stage('Update-README') { + when { + branch "master" + environment name: 'CHANGE_ID', value: '' + expression { + env.CONTAINER_NAME != null + } + } + steps { + sh '''#! /bin/bash + TEMPDIR=$(mktemp -d) + docker pull linuxserver/doc-builder:latest + docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -v ${TEMPDIR}:/ansible/readme linuxserver/doc-builder:latest + if [ "$(md5sum ${TEMPDIR}/${CONTAINER_NAME}/README.md | awk '{ print $1 }')" != "$(md5sum README.md | awk '{ print $1 }')" ]; then + git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/${LS_REPO} + cp ${TEMPDIR}/${CONTAINER_NAME}/README.md ${TEMPDIR}/${LS_REPO}/ + cd ${TEMPDIR}/${LS_REPO}/ + git --git-dir ${TEMPDIR}/${LS_REPO}/.git add README.md + git --git-dir ${TEMPDIR}/${LS_REPO}/.git commit -m 'Bot Updating README from template' + git --git-dir ${TEMPDIR}/${LS_REPO}/.git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all + echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER} + else + echo "false" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER} + fi + rm -Rf ${TEMPDIR}''' + script{ + env.README_UPDATED = sh( + script: '''cat /tmp/${COMMIT_SHA}-${BUILD_NUMBER}''', + returnStdout: true).trim() + } + } + } + // Exit the build if the Readme was just updated + stage('README-exit') { + when { + branch "master" + environment name: 'CHANGE_ID', value: '' + environment name: 'README_UPDATED', value: 'true' + expression { + env.CONTAINER_NAME != null + } + } + steps { + script{ + env.CI_URL = 'README_UPDATE' + env.RELEASE_LINK = 'README_UPDATE' + currentBuild.rawBuild.result = Result.ABORTED + throw new hudson.AbortException('ABORTED_README') + } + } + } + /* ############### + Build Container + ############### */ + // Build Docker container for push to LS Repo + stage('Build-Single') { + when { + environment name: 'MULTIARCH', value: 'false' + } + steps { + sh "docker build --no-cache -t ${IMAGE}:${META_TAG} \ + --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." + } + } + // Build MultiArch Docker containers for push to LS Repo + stage('Build-Multi') { + when { + environment name: 'MULTIARCH', value: 'true' + } + parallel { + stage('Build X86') { + steps { + sh "docker build --no-cache -t ${IMAGE}:amd64-${META_TAG} \ + --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." + } + } + stage('Build ARMHF') { + agent { + label 'ARMHF' + } + steps { + withCredentials([ + [ + $class: 'UsernamePasswordMultiBinding', + credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207', + usernameVariable: 'DOCKERUSER', + passwordVariable: 'DOCKERPASS' + ] + ]) { + echo 'Logging into DockerHub' + sh '''#! /bin/bash + echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin + ''' + sh "curl https://lsio-ci.ams3.digitaloceanspaces.com/qemu-arm-static -o qemu-arm-static" + sh "chmod +x qemu-*" + sh "docker build --no-cache -f Dockerfile.armhf -t ${IMAGE}:arm32v6-${META_TAG} \ + --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." + sh "docker tag ${IMAGE}:arm32v6-${META_TAG} lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER}" + sh "docker push lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER}" + } + } + } + stage('Build ARM64') { + agent { + label 'ARM64' + } + steps { + withCredentials([ + [ + $class: 'UsernamePasswordMultiBinding', + credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207', + usernameVariable: 'DOCKERUSER', + passwordVariable: 'DOCKERPASS' + ] + ]) { + echo 'Logging into DockerHub' + sh '''#! /bin/bash + echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin + ''' + sh "curl https://lsio-ci.ams3.digitaloceanspaces.com/qemu-aarch64-static -o qemu-aarch64-static" + sh "chmod +x qemu-*" + sh "docker build --no-cache -f Dockerfile.aarch64 -t ${IMAGE}:arm64v8-${META_TAG} \ + --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." + sh "docker tag ${IMAGE}:arm64v8-${META_TAG} lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}" + sh "docker push lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}" + } + } + } + } + } + /* ####### + Testing + ####### */ + // Run Container tests + stage('Test') { + when { + environment name: 'CI', value: 'true' + } + steps { + withCredentials([ + string(credentialsId: 'spaces-key', variable: 'DO_KEY'), + string(credentialsId: 'spaces-secret', variable: 'DO_SECRET') + ]) { + sh '''#! /bin/bash + docker pull lsiodev/ci:latest + if [ "${MULTIARCH}" == "true" ]; then + docker pull lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER} + docker pull lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} + docker tag lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER} ${IMAGE}:arm32v6-${META_TAG} + docker tag lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} ${IMAGE}:arm64v8-${META_TAG} + fi + docker run --rm \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -e IMAGE=\"${IMAGE}\" \ + -e DELAY_START=\"${CI_DELAY}\" \ + -e TAGS=\"${CI_TAGS}\" \ + -e META_TAG=\"${META_TAG}\" \ + -e PORT=\"${CI_PORT}\" \ + -e SSL=\"${CI_SSL}\" \ + -e BASE=\"${DIST_IMAGE}\" \ + -e SECRET_KEY=\"${DO_SECRET}\" \ + -e ACCESS_KEY=\"${DO_KEY}\" \ + -e DOCKER_ENV=\"${CI_DOCKERENV}\" \ + -e WEB_SCREENSHOT=\"${CI_WEB}\" \ + -e WEB_AUTH=\"${CI_AUTH}\" \ + -e WEB_PATH=\"${CI_WEBPATH}\" \ + -e DO_REGION="ams3" \ + -e DO_BUCKET="lsio-ci" \ + -t lsiodev/ci:latest \ + python /ci/ci.py''' + script{ + env.CI_URL = 'https://lsio-ci.ams3.digitaloceanspaces.com/' + env.IMAGE + '/' + env.META_TAG + '/index.html' + } + } + } + } + /* ################## + Release Logic + ################## */ + // If this is an amd64 only image only push a single image + stage('Docker-Push-Single') { + when { + environment name: 'MULTIARCH', value: 'false' + } + steps { + withCredentials([ + [ + $class: 'UsernamePasswordMultiBinding', + credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207', + usernameVariable: 'DOCKERUSER', + passwordVariable: 'DOCKERPASS' + ] + ]) { + echo 'Logging into DockerHub' + sh '''#! /bin/bash + echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin + ''' + sh "docker tag ${IMAGE}:${META_TAG} ${IMAGE}:latest" + sh "docker push ${IMAGE}:latest" + sh "docker push ${IMAGE}:${META_TAG}" + } + } + } + // If this is a multi arch release push all images and define the manifest + stage('Docker-Push-Multi') { + when { + environment name: 'MULTIARCH', value: 'true' + } + steps { + withCredentials([ + [ + $class: 'UsernamePasswordMultiBinding', + credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207', + usernameVariable: 'DOCKERUSER', + passwordVariable: 'DOCKERPASS' + ] + ]) { + sh '''#! /bin/bash + echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin + ''' + sh '''#! /bin/bash + if [ "${CI}" == "false" ]; then + docker pull lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER} + docker pull lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} + docker tag lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER} ${IMAGE}:arm32v6-${META_TAG} + docker tag lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} ${IMAGE}:arm64v8-${META_TAG} + fi''' + sh "docker tag ${IMAGE}:amd64-${META_TAG} ${IMAGE}:amd64-latest" + sh "docker tag ${IMAGE}:arm32v6-${META_TAG} ${IMAGE}:arm32v6-latest" + sh "docker tag ${IMAGE}:arm64v8-${META_TAG} ${IMAGE}:arm64v8-latest" + sh "docker push ${IMAGE}:amd64-${META_TAG}" + sh "docker push ${IMAGE}:arm32v6-${META_TAG}" + sh "docker push ${IMAGE}:arm64v8-${META_TAG}" + sh "docker push ${IMAGE}:amd64-latest" + sh "docker push ${IMAGE}:arm32v6-latest" + sh "docker push ${IMAGE}:arm64v8-latest" + sh "docker manifest push --purge ${IMAGE}:latest || :" + sh "docker manifest create ${IMAGE}:latest ${IMAGE}:amd64-latest ${IMAGE}:arm32v6-latest ${IMAGE}:arm64v8-latest" + sh "docker manifest annotate ${IMAGE}:latest ${IMAGE}:arm32v6-latest --os linux --arch arm" + sh "docker manifest annotate ${IMAGE}:latest ${IMAGE}:arm64v8-latest --os linux --arch arm64 --variant v8" + sh "docker manifest push --purge ${IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER} || :" + sh "docker manifest create ${IMAGE}:${META_TAG} ${IMAGE}:amd64-${META_TAG} ${IMAGE}:arm32v6-${META_TAG} ${IMAGE}:arm64v8-${META_TAG}" + sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm32v6-${META_TAG} --os linux --arch arm" + sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm64v8-${META_TAG} --os linux --arch arm64 --variant v8" + sh "docker manifest push --purge ${IMAGE}:latest" + sh "docker manifest push --purge ${IMAGE}:${META_TAG}" + } + } + } + // If this is a public release tag it in the LS Github and push a changelog from external repo and our internal one + stage('Github-Tag-Push-Release') { + when { + branch "master" + expression { + env.LS_RELEASE != env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-ls' + env.LS_TAG_NUMBER + } + environment name: 'CHANGE_ID', value: '' + } + steps { + echo "Pushing New tag for current commit ${EXT_RELEASE}-pkg-${PACKAGE_TAG}-ls${LS_TAG_NUMBER}" + sh '''curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/git/tags \ + -d '{"tag":"'${EXT_RELEASE}'-pkg-'${PACKAGE_TAG}'-ls'${LS_TAG_NUMBER}'",\ + "object": "'${COMMIT_SHA}'",\ + "message": "Tagging Release '${EXT_RELEASE}'-pkg-'${PACKAGE_TAG}'-ls'${LS_TAG_NUMBER}' to master",\ + "type": "commit",\ + "tagger": {"name": "LinuxServer Jenkins","email": "jenkins@linuxserver.io","date": "'${GITHUB_DATE}'"}}' ''' + echo "Pushing New release for Tag" + sh '''#! /bin/bash + echo "Updating base packages to ${PACKAGE_TAG}" > releasebody.json + echo '{"tag_name":"'${EXT_RELEASE}'-pkg-'${PACKAGE_TAG}'-ls'${LS_TAG_NUMBER}'",\ + "target_commitish": "master",\ + "name": "'${EXT_RELEASE}'-pkg-'${PACKAGE_TAG}'-ls'${LS_TAG_NUMBER}'",\ + "body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n**OS Changes:**\\n\\n' > start + printf '","draft": false,"prerelease": false}' >> releasebody.json + paste -d'\\0' start releasebody.json > releasebody.json.done + curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done''' + } + } + // Use helper container to sync the current README on master to the dockerhub endpoint + stage('Sync-README') { + when { + environment name: 'CHANGE_ID', value: '' + } + steps { + withCredentials([ + [ + $class: 'UsernamePasswordMultiBinding', + credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207', + usernameVariable: 'DOCKERUSER', + passwordVariable: 'DOCKERPASS' + ] + ]) { + sh '''#! /bin/bash + docker pull lsiodev/readme-sync + docker run --rm=true \ + -e DOCKERHUB_USERNAME=$DOCKERUSER \ + -e DOCKERHUB_PASSWORD=$DOCKERPASS \ + -e GIT_REPOSITORY=${LS_USER}/${LS_REPO} \ + -e DOCKER_REPOSITORY=${IMAGE} \ + -e GIT_BRANCH=master \ + lsiodev/readme-sync bash -c 'node sync' ''' + } + } + } + } + /* ###################### + Send status to Discord + ###################### */ + post { + success { + sh ''' curl -X POST --data '{"avatar_url": "https://wiki.jenkins-ci.org/download/attachments/2916393/headshot.png","embeds": [{"color": 1681177,\ + "description": "**Build:** '${BUILD_NUMBER}'\\n**CI Results:** '${CI_URL}'\\n**Status:** Success\\n**Job:** '${RUN_DISPLAY_URL}'\\n**Change:** '${CODE_URL}'\\n**External Release:**: '${RELEASE_LINK}'\\n**DockerHub:** '${DOCKERHUB_LINK}'\\n"}],\ + "username": "Jenkins"}' ${BUILDS_DISCORD} ''' + } + failure { + sh ''' curl -X POST --data '{"avatar_url": "https://wiki.jenkins-ci.org/download/attachments/2916393/headshot.png","embeds": [{"color": 16711680,\ + "description": "**Build:** '${BUILD_NUMBER}'\\n**CI Results:** '${CI_URL}'\\n**Status:** failure\\n**Job:** '${RUN_DISPLAY_URL}'\\n**Change:** '${CODE_URL}'\\n**External Release:**: '${RELEASE_LINK}'\\n**DockerHub:** '${DOCKERHUB_LINK}'\\n"}],\ + "username": "Jenkins"}' ${BUILDS_DISCORD} ''' + } + } +} diff --git a/README.md b/README.md index 4b6fa5b..04f631f 100644 --- a/README.md +++ b/README.md @@ -1,90 +1,118 @@ -[linuxserverurl]: https://linuxserver.io -[forumurl]: https://forum.linuxserver.io -[ircurl]: https://www.linuxserver.io/irc/ -[podcasturl]: https://www.linuxserver.io/podcast/ -[appurl]: http://www.duckdns.org/ -[hub]: https://hub.docker.com/r/linuxserver/duckdns/ +[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)](https://linuxserver.io) -[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)][linuxserverurl] +The [LinuxServer.io](https://linuxserver.io) team brings you another container release featuring :- -The [LinuxServer.io][linuxserverurl] team brings you another container release featuring easy user mapping and community support. Find us for support at: -* [forum.linuxserver.io][forumurl] -* [IRC][ircurl] on freenode at `#linuxserver.io` -* [Podcast][podcasturl] covers everything to do with getting the most from your Linux Server plus a focus on all things Docker and containerisation! + * regular and timely application updates + * easy user mappings (PGID, PUID) + * custom base image with s6 overlay + * weekly base OS updates with common layers across the entire LinuxServer.io ecosystem to minimise space usage, down time and bandwidth + * regular security updates -# linuxserver/duckdns -[![](https://images.microbadger.com/badges/version/linuxserver/duckdns.svg)](https://microbadger.com/images/linuxserver/duckdns "Get your own version badge on microbadger.com")[![](https://images.microbadger.com/badges/image/linuxserver/duckdns.svg)](https://microbadger.com/images/linuxserver/duckdns "Get your own image badge on microbadger.com")[![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/duckdns.svg)][hub][![Docker Stars](https://img.shields.io/docker/stars/linuxserver/duckdns.svg)][hub][![Build Status](https://ci.linuxserver.io/buildStatus/icon?job=Docker-Builders/x86-64/x86-64-duckdns)](https://ci.linuxserver.io/job/Docker-Builders/job/x86-64/job/x86-64-duckdns/) +Find us at: +* [Discord](https://discord.gg/YWrKVTn) - realtime support / chat with the community and the team. +* [IRC](https://irc.linuxserver.io) - on freenode at `#linuxserver.io`. Our primary support channel is Discord. +* [Blog](https://blog.linuxserver.io) - all the things you can do with our containers including How-To guides, opinions and much more! +* [Podcast](https://podcast.linuxserver.io) - on hiatus. Coming back soon (late 2018). -Duck DNS is a free service which will point a DNS (sub domains of duckdns.org) to an IP of your choice. The service is completely free, and doesn't require reactivation or forum posts to maintain its existence. +# PSA: Changes are happening -[![duckdns](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/duckdns.png)][appurl] +From August 2018 onwards, Linuxserver are in the midst of switching to a new CI platform which will enable us to build and release multiple architectures under a single repo. To this end, existing images for `arm64` and `armhf` builds are being deprecated. They are replaced by a manifest file in each container which automatically pulls the correct image for your architecture. You'll also be able to pull based on a specific architecture tag. + +TLDR: Multi-arch support is changing from multiple repos to one repo per container image. + +# [linuxserver/duckdns](https://github.com/linuxserver/docker-duckdns) +[![](https://images.microbadger.com/badges/version/linuxserver/duckdns.svg)](https://microbadger.com/images/linuxserver/duckdns "Get your own version badge on microbadger.com") +[![](https://images.microbadger.com/badges/image/linuxserver/duckdns.svg)](https://microbadger.com/images/linuxserver/duckdns "Get your own version badge on microbadger.com") +![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/duckdns.svg) +![Docker Stars](https://img.shields.io/docker/stars/linuxserver/duckdns.svg) + +[Duckdns](https://duckdns.org/) is a free service which will point a DNS (sub domains of duckdns.org) to an IP of your choice. The service is completely free, and doesn't require reactivation or forum posts to maintain its existence. + +[![duckdns](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/duckdns.png)](https://duckdns.org/) + +## Supported Architectures + +Our images support multiple architectures such as `X86-64`, `arm64` and `armhf`. We utilise the docker manifest for multi-platform awareness. More information is available from docker [here](https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md#manifest-list). + +The architectures supported by this image are: + +| Architecture | Tag | +| :----: | --- | +| X86-64 | amd64-latest | +| arm64 | arm64v8-latest | +| armhf | arm32v6-latest | ## Usage +Here are some example snippets to help you get started creating a container. + +### docker + ``` docker create \ --name=duckdns \ - -e PGID= -e PUID= \ - -e SUBDOMAINS= \ - -e TOKEN= \ - -e TZ= \ + -e TZ=Europe/London \ + -e SUBDOMAINS=subdomain1,subdomain2 \ + -e TOKEN=token \ linuxserver/duckdns ``` -## Parameters +### optional parameters +`-e LOG_FILE=true` if you prefer the duckdns log to be written to a file instead of the docker log +`-v :/config` used in conjunction with logging to file -`The parameters are split into two halves, separated by a colon, the left hand side representing the host and the right the container side. -For example with a port -p external:internal - what this shows is the port mapping from internal to external of the container. -So -p 8080:80 would expose port 80 from inside the container to be accessible from the host's IP on port 8080 -http://192.168.x.x:8080 would show you what's running INSIDE the container on port 80.` +### docker-compose +Compatible with docker-compose v2 schemas. -* `-e PGID` for GroupID - see below for explanation -* `-e PUID` for UserID - see below for explanation -* `-e SUBDOMAINS` for subdomains - multiple subdomains allowed, comma separated, no spaces -* `-e TOKEN` for DuckDNS token -* `-e TZ` for timezone information, eg Europe/London -* optional `-e LOG_FILE=true` if you prefer the duckdns log to be written to a file instead of the docker log -* optional `-v :/config` used in conjunction with logging to file - +``` +--- +version: "2" +services: + duckdns: + image: linuxserver/duckdns + container_name: duckdns + - TZ=Europe/London + - SUBDOMAINS=subdomain1,subdomain2 + - TOKEN=token + mem_limit: 4096m + restart: unless-stopped +``` -### User / Group Identifiers +## Parameters -Sometimes when using data volumes (`-v` flags) permissions issues can arise between the host OS and the container. We avoid this issue by allowing you to specify the user `PUID` and group `PGID`. Ensure the data volume directory on the host is owned by the same user you specify and it will "just work" ™. +Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate `:` respectively. For example, `-p 8080:80` would expose port `80` from inside the container to be accessible from the host's IP on port `8080` outside the container. -In this instance `PUID=1001` and `PGID=1001`. To find yours use `id user` as below: +| Parameter | Function | +| :----: | --- | +| `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London | +| `-e SUBDOMAINS=subdomain1,subdomain2` | multiple subdomains allowed, comma separated, no spaces | +| `-e TOKEN=token` | DuckDNS token | -``` - $ id - uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup) -``` -## Setting up the application +  +## Application Setup -First, go to [duckdns site][appurl], register your subdomain and retrieve your token -Then run the docker create command above with your subdomain(s) and token -It will update your IP with the DuckDNS service every 5 minutes +- Go to the [duckdns website](https://duckdns.org/), register your subdomain(s) and retrieve your token +- Create a container with your subdomain(s) and token +- It will update your IP with the DuckDNS service every 5 minutes -If you'd like the output in a file, set the optional parameter LOG_FILE to true and map a volume for /config -## Info +## Support Info * Shell access whilst the container is running: `docker exec -it duckdns /bin/bash` * To monitor the logs of the container in realtime: `docker logs -f duckdns` - * container version number - -`docker inspect -f '{{ index .Config.Labels "build_version" }}' duckdns` - + * `docker inspect -f '{{ index .Config.Labels "build_version" }}' duckdns` * image version number - -`docker inspect -f '{{ index .Config.Labels "build_version" }}' linuxserver/duckdns` + * `docker inspect -f '{{ index .Config.Labels "build_version" }}' linuxserver/duckdns` ## Versions -+ **22.08.18:** Rebase to alpine 3.8. -+ **08.12.17:** Rebase to alpine 3.7. -+ **28.05.17:** Rebase to alpine 3.6. -+ **09.02.17:** Rebase to alpine 3.5. -+ **17.11.16:** Initial release +* **15.10.18:** - Multi-arch image. +* **22.08.18:** - Rebase to alpine 3.8. +* **08.12.17:** - Rebase to alpine 3.7. +* **28.05.17:** - Rebase to alpine 3.6. +* **09.02.17:** - Rebase to alpine 3.5. +* **17.11.16:** - Initial release. diff --git a/readme-vars.yml b/readme-vars.yml new file mode 100644 index 0000000..a130644 --- /dev/null +++ b/readme-vars.yml @@ -0,0 +1,50 @@ +--- + +# project information +project_name: duckdns +project_url: "https://duckdns.org/" +project_logo: "https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/duckdns.png" +project_blurb: "[{{ project_name|capitalize }}]({{ project_url }}) is a free service which will point a DNS (sub domains of duckdns.org) to an IP of your choice. The service is completely free, and doesn't require reactivation or forum posts to maintain its existence." +project_lsio_github_repo_url: "https://github.com/linuxserver/docker-{{ project_name }}" + +# supported architectures +available_architectures: + - { arch: "{{ arch_x86_64 }}", tag: "amd64-latest"} + - { arch: "{{ arch_arm64 }}", tag: "arm64v8-latest"} + - { arch: "{{ arch_armhf }}", tag: "arm32v6-latest"} + +# container parameters +common_param_env_vars_enabled: false +param_container_name: "{{ project_name }}" +param_usage_include_vols: false +param_volumes: "" +param_usage_include_ports: false +param_ports: "" +param_usage_include_env: true +param_env_vars: + - { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London"} + - { env_var: "SUBDOMAINS", env_value: "subdomain1,subdomain2", desc: "multiple subdomains allowed, comma separated, no spaces"} + - { env_var: "TOKEN", env_value: "token", desc: "DuckDNS token"} + +# optional parameters +optional_block_1: true +optional_block_1_items: + - "### optional parameters" + - "`-e LOG_FILE=true` if you prefer the duckdns log to be written to a file instead of the docker log " + - "`-v :/config` used in conjunction with logging to file" + +# application setup block +app_setup_block_enabled: true +app_setup_block: | + - Go to the [duckdns website]({{project_url}}), register your subdomain(s) and retrieve your token + - Create a container with your subdomain(s) and token + - It will update your IP with the DuckDNS service every 5 minutes + +# changelog +changelogs: + - { date: "15.10.18:", desc: "Multi-arch image." } + - { date: "22.08.18:", desc: "Rebase to alpine 3.8." } + - { date: "08.12.17:", desc: "Rebase to alpine 3.7." } + - { date: "28.05.17:", desc: "Rebase to alpine 3.6." } + - { date: "09.02.17:", desc: "Rebase to alpine 3.5." } + - { date: "17.11.16:", desc: "Initial release." } diff --git a/root/etc/cont-init.d/40_config.sh b/root/etc/cont-init.d/40-config similarity index 100% rename from root/etc/cont-init.d/40_config.sh rename to root/etc/cont-init.d/40-config