From 6ddded8694fb3dfcd2993cabfb25dccb796ec6cc Mon Sep 17 00:00:00 2001 From: thelamer Date: Sun, 19 Aug 2018 21:24:06 -0700 Subject: [PATCH] adding live pipeline logic and dynamically generated readme variables --- Dockerfile.amd64 => Dockerfile | 0 Jenkinsfile | 552 ++++++++++++++------------------- README.md | 169 +++++++++- READMETEMPLATE.md | 127 -------- readme-vars.yml | 64 ++++ 5 files changed, 451 insertions(+), 461 deletions(-) rename Dockerfile.amd64 => Dockerfile (100%) delete mode 100644 READMETEMPLATE.md create mode 100644 readme-vars.yml diff --git a/Dockerfile.amd64 b/Dockerfile similarity index 100% rename from Dockerfile.amd64 rename to Dockerfile diff --git a/Jenkinsfile b/Jenkinsfile index 86f5658..88ca27a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,11 +8,12 @@ pipeline { BUILD_VERSION_ARG = 'BOOKSTACK_RELEASE' LS_USER = 'linuxserver' LS_REPO = 'docker-bookstack' + CONTAINER_NAME = 'bookstack' DOCKERHUB_IMAGE = 'lspipelive/bookstack' DEV_DOCKERHUB_IMAGE = 'lspipetest/bookstack' PR_DOCKERHUB_IMAGE = 'lspipepr/bookstack' BUILDS_DISCORD = credentials('build_webhook_url') - GITHUB_TOKEN = credentials('github_token') + GITHUB_TOKEN = credentials('498b4638-2d02-4ce5-832d-8a57d01d97ab') DIST_IMAGE = 'alpine' DIST_TAG = '3.7' DIST_PACKAGES = 'curl \ @@ -85,10 +86,6 @@ pipeline { ####################### */ // If this is an alpine base image determine the base package tag to use stage("Set Package tag Alpine"){ - when { - environment name: 'DIST_IMAGE', value: 'alpine' - not {environment name: 'DIST_PACKAGES', value: 'none'} - } steps{ sh '''docker pull alpine:${DIST_TAG}''' script{ @@ -99,54 +96,136 @@ pipeline { } } } - // If this is an ubuntu base image determine the base package tag to use - stage("Set Package tag Ubuntu"){ - when { - environment name: 'DIST_IMAGE', value: 'ubuntu' - not {environment name: 'DIST_PACKAGES', value: 'none'} - } - steps{ - sh '''docker pull ubuntu:${DIST_TAG}''' - script{ - env.PACKAGE_TAG = sh( - script: '''docker run --rm ubuntu:${DIST_TAG} sh -c\ - 'apt-get --allow-unauthenticated update -qq >/dev/null 2>&1 &&\ - apt-cache --no-all-versions show '"${DIST_PACKAGES}"' | md5sum | cut -c1-8' ''', - returnStdout: true).trim() - } - } - } - // If there are no base packages to tag in this build config set to none - stage("Set Package tag none"){ - when { - environment name: 'DIST_PACKAGES', value: 'none' - } - steps{ - script{ - env.PACKAGE_TAG = sh( - script: '''echo none''', - returnStdout: true).trim() - } - } - } /* ######################## External Release Tagging ######################## */ // If this is a stable github release use the latest endpoint from github to determine the ext tag stage("Set ENV github_stable"){ - steps{ + steps{ + script{ + env.EXT_RELEASE = sh( + script: '''curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq -r '. | .tag_name' ''', + returnStdout: true).trim() + } + } + } + // If this is a stable or devel github release generate the link for the build message + stage("Set ENV github_link"){ + steps{ + script{ + env.RELEASE_LINK = 'https://github.com/' + env.EXT_USER + '/' + env.EXT_REPO + '/releases/tag/' + env.EXT_RELEASE + } + } + } + // If this is a master build use live docker endpoints + stage("Set ENV live build"){ + 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 { script{ - env.EXT_RELEASE = sh( - script: '''curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq -r '. | .tag_name' ''', + 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: ''} + environment name: 'MULTIARCH', value: 'false' + } + 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() } } } - // If this is a stable or devel github release generate the link for the build message - stage("Set ENV github_link"){ - steps{ + // 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.RELEASE_LINK = 'https://github.com/' + env.EXT_USER + '/' + env.EXT_REPO + '/releases/tag/' + env.EXT_RELEASE + env.CI_URL = 'README_UPDATE' + env.RELEASE_LINK = 'README_UPDATE' + currentBuild.rawBuild.result = Result.ABORTED + throw new hudson.AbortException('ABORTED_README') } } } @@ -159,108 +238,73 @@ pipeline { environment name: 'MULTIARCH', value: 'false' } steps { - sh "docker build --no-cache -t ${DOCKERHUB_IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER} \ - --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${EXT_RELEASE}-pkg-${PACKAGE_TAG}-ls${LS_TAG_NUMBER}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." - script{ - env.CI_IMAGE = env.DOCKERHUB_IMAGE - env.CI_TAGS = env.EXT_RELEASE + '-ls' + env.LS_TAG_NUMBER - env.CI_META_TAG = env.EXT_RELEASE + '-ls' + env.LS_TAG_NUMBER - } + 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 container for push to LS Repo + // Build MultiArch Docker containers for push to LS Repo stage('Build-Multi') { when { environment name: 'MULTIARCH', value: 'true' } - steps { - sh "wget https://lsio-ci.ams3.digitaloceanspaces.com/qemu-aarch64-static" - sh "wget https://lsio-ci.ams3.digitaloceanspaces.com/qemu-arm-static" - sh "chmod +x qemu-*" - sh "docker build --no-cache -f Dockerfile.amd64 -t ${DOCKERHUB_IMAGE}:amd64-${EXT_RELEASE}-ls${LS_TAG_NUMBER} \ - --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${EXT_RELEASE}-pkg-${PACKAGE_TAG}-ls${LS_TAG_NUMBER}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." - sh "docker build --no-cache -f Dockerfile.armhf -t ${DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-ls${LS_TAG_NUMBER} \ - --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${EXT_RELEASE}-pkg-${PACKAGE_TAG}-ls${LS_TAG_NUMBER}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." - sh "docker build --no-cache -f Dockerfile.aarch64 -t ${DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-ls${LS_TAG_NUMBER} \ - --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${EXT_RELEASE}-pkg-${PACKAGE_TAG}-ls${LS_TAG_NUMBER}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." - script{ - env.CI_IMAGE = env.DOCKERHUB_IMAGE - 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 - env.CI_META_TAG = env.EXT_RELEASE + '-ls' + env.LS_TAG_NUMBER + 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} ." + } } - } - } - // Tag to the Dev user dockerhub endpoint when this is a non master branch - stage('Docker-Tag-Dev-Single') { - when { - not {branch "master"} - environment name: 'CHANGE_ID', value: '' - environment name: 'MULTIARCH', value: 'false' - } - steps { - sh "docker tag ${DOCKERHUB_IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DEV_DOCKERHUB_IMAGE}:latest" - sh "docker tag ${DOCKERHUB_IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DEV_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA}" - script{ - env.CI_IMAGE = env.DEV_DOCKERHUB_IMAGE - env.CI_TAGS = env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA - env.CI_META_TAG = env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA + 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}" + } + } } - } - } - // Tag to the Dev user dockerhub endpoint when this is a non master branch - stage('Docker-Tag-Dev-Multi') { - when { - not {branch "master"} - environment name: 'CHANGE_ID', value: '' - environment name: 'MULTIARCH', value: 'true' - } - steps { - sh "docker tag ${DOCKERHUB_IMAGE}:amd64-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DEV_DOCKERHUB_IMAGE}:amd64-latest" - sh "docker tag ${DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DEV_DOCKERHUB_IMAGE}:arm32v6-latest" - sh "docker tag ${DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DEV_DOCKERHUB_IMAGE}:arm64v8-latest" - sh "docker tag ${DOCKERHUB_IMAGE}:amd64-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DEV_DOCKERHUB_IMAGE}:amd64-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA}" - sh "docker tag ${DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DEV_DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA}" - sh "docker tag ${DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DEV_DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA}" - script{ - env.CI_IMAGE = env.DEV_DOCKERHUB_IMAGE - 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 - env.CI_META_TAG = env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA - } - } - } - // Tag to PR user dockerhub endpoint when this is a pull request - stage('Docker-Tag-PR-Single') { - when { - not {environment name: 'CHANGE_ID', value: ''} - environment name: 'MULTIARCH', value: 'false' - } - steps { - sh "docker tag ${DOCKERHUB_IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${PR_DOCKERHUB_IMAGE}:latest" - sh "docker tag ${DOCKERHUB_IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${PR_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST}" - script{ - env.CI_IMAGE = env.PR_DOCKERHUB_IMAGE - env.CI_TAGS = env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST - env.CI_META_TAG = env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST - } - } - } - // Tag to PR user dockerhub endpoint when this is a pull request - stage('Docker-Tag-PR-Multi') { - when { - not {environment name: 'CHANGE_ID', value: ''} - environment name: 'MULTIARCH', value: 'true' - } - steps { - sh "docker tag ${DOCKERHUB_IMAGE}:amd64-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${PR_DOCKERHUB_IMAGE}:amd64-latest" - sh "docker tag ${DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${PR_DOCKERHUB_IMAGE}:arm32v6-latest" - sh "docker tag ${DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${PR_DOCKERHUB_IMAGE}:arm64v8-latest" - sh "docker tag ${DOCKERHUB_IMAGE}:amd64-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${PR_DOCKERHUB_IMAGE}:amd64-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST}" - sh "docker tag ${DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${PR_DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST}" - sh "docker tag ${DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${PR_DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST}" - script{ - env.CI_IMAGE = env.PR_DOCKERHUB_IMAGE - 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 - env.CI_META_TAG = env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST + 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}" + } + } } } } @@ -279,12 +323,18 @@ pipeline { ]) { 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=\"${CI_IMAGE}\" \ + -e IMAGE=\"${IMAGE}\" \ -e DELAY_START=\"${CI_DELAY}\" \ -e TAGS=\"${CI_TAGS}\" \ - -e META_TAG=\"${CI_META_TAG}\" \ + -e META_TAG=\"${META_TAG}\" \ -e PORT=\"${CI_PORT}\" \ -e SSL=\"${CI_SSL}\" \ -e BASE=\"${DIST_IMAGE}\" \ @@ -299,28 +349,24 @@ pipeline { -t lsiodev/ci:latest \ python /ci/ci.py''' script{ - env.CI_URL = 'https://lsio-ci.ams3.digitaloceanspaces.com/' + env.CI_IMAGE + '/' + env.CI_META_TAG + '/index.html' + env.CI_URL = 'https://lsio-ci.ams3.digitaloceanspaces.com/' + env.IMAGE + '/' + env.META_TAG + '/index.html' } } } } /* ################## - Live Release Logic + Release Logic ################## */ - // If this is a public release push this to the live repo triggered by an external repo update or LS repo update on master - stage('Docker-Push-Release-Single') { + // If this is an amd64 only image only push a single image + stage('Docker-Push-Single') { when { - branch "master" environment name: 'MULTIARCH', value: 'false' - expression { - env.LS_RELEASE != env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-ls' + env.LS_TAG_NUMBER - } } steps { withCredentials([ [ $class: 'UsernamePasswordMultiBinding', - credentialsId: 'c1701109-4bdc-4a9c-b3ea-480bec9a2ca6', + credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207', usernameVariable: 'DOCKERUSER', passwordVariable: 'DOCKERPASS' ] @@ -329,26 +375,22 @@ pipeline { sh '''#! /bin/bash echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin ''' - sh "docker tag ${DOCKERHUB_IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DOCKERHUB_IMAGE}:latest" - sh "docker push ${DOCKERHUB_IMAGE}:latest" - sh "docker push ${DOCKERHUB_IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER}" + sh "docker tag ${IMAGE}:${META_TAG} ${IMAGE}:latest" + sh "docker push ${IMAGE}:latest" + sh "docker push ${IMAGE}:${META_TAG}" } } } - // If this is a public release push this to the live repo triggered by an external repo update or LS repo update on master - stage('Docker-Push-Release-Multi') { + // If this is a multi arch release push all images and define the manifest + stage('Docker-Push-Multi') { when { - branch "master" environment name: 'MULTIARCH', value: 'true' - expression { - env.LS_RELEASE != env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-ls' + env.LS_TAG_NUMBER - } } steps { withCredentials([ [ $class: 'UsernamePasswordMultiBinding', - credentialsId: 'c1701109-4bdc-4a9c-b3ea-480bec9a2ca6', + credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207', usernameVariable: 'DOCKERUSER', passwordVariable: 'DOCKERPASS' ] @@ -356,25 +398,32 @@ pipeline { sh '''#! /bin/bash echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin ''' - sh "docker tag ${DOCKERHUB_IMAGE}:amd64-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DOCKERHUB_IMAGE}:amd64-latest" - sh "docker tag ${DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DOCKERHUB_IMAGE}:arm32v6-latest" - sh "docker tag ${DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DOCKERHUB_IMAGE}:arm64v8-latest" - sh "docker push ${DOCKERHUB_IMAGE}:amd64-${EXT_RELEASE}-ls${LS_TAG_NUMBER}" - sh "docker push ${DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-ls${LS_TAG_NUMBER}" - sh "docker push ${DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-ls${LS_TAG_NUMBER}" - sh "docker push ${DOCKERHUB_IMAGE}:amd64-latest" - sh "docker push ${DOCKERHUB_IMAGE}:arm32v6-latest" - sh "docker push ${DOCKERHUB_IMAGE}:arm64v8-latest" - sh "docker manifest push --purge ${DOCKERHUB_IMAGE}:latest || :" - sh "docker manifest create ${DOCKERHUB_IMAGE}:latest ${DOCKERHUB_IMAGE}:amd64-latest ${DOCKERHUB_IMAGE}:arm32v6-latest ${DOCKERHUB_IMAGE}:arm64v8-latest" - sh "docker manifest annotate ${DOCKERHUB_IMAGE}:latest ${DOCKERHUB_IMAGE}:arm32v6-latest --os linux --arch arm" - sh "docker manifest annotate ${DOCKERHUB_IMAGE}:latest ${DOCKERHUB_IMAGE}:arm64v8-latest --os linux --arch arm64 --variant armv8" - sh "docker manifest push --purge ${DOCKERHUB_IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER} || :" - sh "docker manifest create ${DOCKERHUB_IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DOCKERHUB_IMAGE}:amd64-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-ls${LS_TAG_NUMBER}" - sh "docker manifest annotate ${DOCKERHUB_IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-ls${LS_TAG_NUMBER} --os linux --arch arm" - sh "docker manifest annotate ${DOCKERHUB_IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-ls${LS_TAG_NUMBER} --os linux --arch arm64 --variant armv8" - sh "docker manifest push --purge ${DOCKERHUB_IMAGE}:latest" - sh "docker manifest push --purge ${DOCKERHUB_IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER}" + 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} ${DOCKERHUB_IMAGE}:amd64-latest" + sh "docker tag ${IMAGE}:arm32v6-${META_TAG} ${DOCKERHUB_IMAGE}:arm32v6-latest" + sh "docker tag ${IMAGE}:arm64v8-${META_TAG} ${DOCKERHUB_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 armv8" + 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 armv8" + sh "docker manifest push --purge ${IMAGE}:latest" + sh "docker manifest push --purge ${IMAGE}:${META_TAG}" } } } @@ -407,19 +456,16 @@ pipeline { 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 push the current README in master to the DockerHub Repo + // Use helper container to sync the current README on master to the dockerhub endpoint stage('Sync-README') { 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 { withCredentials([ [ $class: 'UsernamePasswordMultiBinding', - credentialsId: 'c1701109-4bdc-4a9c-b3ea-480bec9a2ca6', + credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207', usernameVariable: 'DOCKERUSER', passwordVariable: 'DOCKERPASS' ] @@ -436,148 +482,6 @@ pipeline { } } } - /* ################# - Dev Release Logic - ################# */ - // Push to the Dev user dockerhub endpoint when this is a non master branch - stage('Docker-Push-Dev-Single') { - when { - not {branch "master"} - environment name: 'CHANGE_ID', value: '' - environment name: 'MULTIARCH', value: 'false' - } - steps { - withCredentials([ - [ - $class: 'UsernamePasswordMultiBinding', - credentialsId: 'c1701109-4bdc-4a9c-b3ea-480bec9a2ca6', - usernameVariable: 'DOCKERUSER', - passwordVariable: 'DOCKERPASS' - ] - ]) { - sh '''#! /bin/bash - echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin - ''' - sh "docker push ${DEV_DOCKERHUB_IMAGE}:latest" - sh "docker push ${DEV_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA}" - } - script{ - env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DEV_DOCKERHUB_IMAGE + '/tags/' - } - } - } - // Push to the Dev user dockerhub endpoint when this is a non master branch - stage('Docker-Push-Dev-Multi') { - when { - not {branch "master"} - environment name: 'CHANGE_ID', value: '' - environment name: 'MULTIARCH', value: 'true' - } - steps { - withCredentials([ - [ - $class: 'UsernamePasswordMultiBinding', - credentialsId: 'c1701109-4bdc-4a9c-b3ea-480bec9a2ca6', - usernameVariable: 'DOCKERUSER', - passwordVariable: 'DOCKERPASS' - ] - ]) { - sh '''#! /bin/bash - echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin - ''' - sh "docker push ${DEV_DOCKERHUB_IMAGE}:amd64-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA}" - sh "docker push ${DEV_DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA}" - sh "docker push ${DEV_DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA}" - sh "docker push ${DEV_DOCKERHUB_IMAGE}:amd64-latest" - sh "docker push ${DEV_DOCKERHUB_IMAGE}:arm32v6-latest" - sh "docker push ${DEV_DOCKERHUB_IMAGE}:arm64v8-latest" - sh "docker manifest push --purge ${DEV_DOCKERHUB_IMAGE}:latest || :" - sh "docker manifest create ${DEV_DOCKERHUB_IMAGE}:latest ${DEV_DOCKERHUB_IMAGE}:amd64-latest ${DEV_DOCKERHUB_IMAGE}:arm32v6-latest ${DEV_DOCKERHUB_IMAGE}:arm64v8-latest" - sh "docker manifest annotate ${DEV_DOCKERHUB_IMAGE}:latest ${DEV_DOCKERHUB_IMAGE}:arm32v6-latest --os linux --arch arm" - sh "docker manifest annotate ${DEV_DOCKERHUB_IMAGE}:latest ${DEV_DOCKERHUB_IMAGE}:arm64v8-latest --os linux --arch arm64 --variant armv8" - sh "docker manifest push --purge ${DEV_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA} || :" - sh "docker manifest create ${DEV_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA} ${DEV_DOCKERHUB_IMAGE}:amd64-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA} ${DEV_DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA} ${DEV_DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA}" - sh "docker manifest annotate ${DEV_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA} ${DEV_DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA} --os linux --arch arm" - sh "docker manifest annotate ${DEV_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA} ${DEV_DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA} --os linux --arch arm64 --variant armv8" - sh "docker manifest push --purge ${DEV_DOCKERHUB_IMAGE}:latest" - sh "docker manifest push --purge ${DEV_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-dev-${COMMIT_SHA}" - } - script{ - env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DEV_DOCKERHUB_IMAGE + '/tags/' - } - } - } - /* ################ - PR Release Logic - ################ */ - // Push to PR user dockerhub endpoint when this is a pull request - stage('Docker-Push-PR-Single') { - when { - not {environment name: 'CHANGE_ID', value: ''} - environment name: 'MULTIARCH', value: 'false' - } - steps { - withCredentials([ - [ - $class: 'UsernamePasswordMultiBinding', - credentialsId: 'c1701109-4bdc-4a9c-b3ea-480bec9a2ca6', - usernameVariable: 'DOCKERUSER', - passwordVariable: 'DOCKERPASS' - ] - ]) { - sh '''#! /bin/bash - echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin - ''' - sh "docker push ${PR_DOCKERHUB_IMAGE}:latest" - sh "docker push ${PR_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST}" - } - script{ - 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/' - } - } - } - // Push to PR user dockerhub endpoint when this is a pull request - stage('Docker-Push-PR-Multi') { - when { - not {environment name: 'CHANGE_ID', value: ''} - environment name: 'MULTIARCH', value: 'true' - } - steps { - withCredentials([ - [ - $class: 'UsernamePasswordMultiBinding', - credentialsId: 'c1701109-4bdc-4a9c-b3ea-480bec9a2ca6', - usernameVariable: 'DOCKERUSER', - passwordVariable: 'DOCKERPASS' - ] - ]) { - sh '''#! /bin/bash - echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin - ''' - sh "docker push ${PR_DOCKERHUB_IMAGE}:amd64-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST}" - sh "docker push ${PR_DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST}" - sh "docker push ${PR_DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST}" - sh "docker push ${PR_DOCKERHUB_IMAGE}:amd64-latest" - sh "docker push ${PR_DOCKERHUB_IMAGE}:arm32v6-latest" - sh "docker push ${PR_DOCKERHUB_IMAGE}:arm64v8-latest" - sh "docker manifest push --purge ${PR_DOCKERHUB_IMAGE}:latest || :" - sh "docker manifest create ${PR_DOCKERHUB_IMAGE}:latest ${PR_DOCKERHUB_IMAGE}:amd64-latest ${PR_DOCKERHUB_IMAGE}:arm32v6-latest ${PR_DOCKERHUB_IMAGE}:arm64v8-latest" - sh "docker manifest annotate ${PR_DOCKERHUB_IMAGE}:latest ${PR_DOCKERHUB_IMAGE}:arm32v6-latest --os linux --arch arm" - sh "docker manifest annotate ${PR_DOCKERHUB_IMAGE}:latest ${PR_DOCKERHUB_IMAGE}:arm64v8-latest --os linux --arch arm64 --variant armv8" - sh "docker manifest create ${PR_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST} ${PR_DOCKERHUB_IMAGE}:amd64-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST} ${PR_DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST} ${PR_DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST}" - sh "docker manifest push --purge ${PR_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST} || :" - sh "docker manifest annotate ${PR_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST} ${PR_DOCKERHUB_IMAGE}:arm32v6-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST} --os linux --arch arm" - sh "docker manifest annotate ${PR_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST} ${PR_DOCKERHUB_IMAGE}:arm64v8-${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST} --os linux --arch arm64 --variant armv8" - sh "docker manifest push --purge ${PR_DOCKERHUB_IMAGE}:latest" - sh "docker manifest push --purge ${PR_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST}" - } - script{ - 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/' - } - } - } } /* ###################### Send status to Discord diff --git a/README.md b/README.md index 2effaa7..6675a98 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,163 @@ -[linuxserverurl]: https://linuxserver.io -[forumurl]: https://forum.linuxserver.io -[discordurl]: https://discord.gg/YWrKVTn -[podcasturl]: https://www.linuxserver.io/podcast/ +[![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 :- -## This is a Container in active development by the [LinuxServer.io][linuxserverurl] team and is not recommended for use by the general public. + * 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 -If you want to comment\contribute on this container , are looking for support on any of our other work , or are curious about us in general, check out the following. +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). -* [forum.linuxserver.io][forumurl] -* [Discord][discordurl] On Discord -* [Podcast][podcasturl] covers everything to do with getting the most from your Linux Server plus a focus on all things Docker and containerisation! +# PSA: Changes are happening + +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/bookstack](https://github.com/linuxserver/docker-bookstack) +[![](https://images.microbadger.com/badges/version/linuxserver/bookstack.svg)](https://microbadger.com/images/linuxserverbookstack "Get your own version badge on microbadger.com") +[![](https://images.microbadger.com/badges/image/linuxserver/bookstack.svg)](https://microbadger.com/images/linuxserver/bookstack "Get your own version badge on microbadger.com") +![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/bookstack.svg) +![Docker Stars](https://img.shields.io/docker/stars/linuxserver/bookstack.svg) + +[Bookstack](https://github.com/BookStackApp/BookStack) is a free and open source Wiki designed for creating beautiful documentation. Feautring a simple, but powerful WYSIWYG editor it allows for teams to create detailed and useful documentation with ease. + +Powered by SQL and including a Markdown editor for those who prefer it, BookStack is geared towards making documentation more of a pleasure than a chore. + +For more information on BookStack visit their website and check it out: https://www.bookstackapp.com + + +[![bookstack](https://s3-us-west-2.amazonaws.com/linuxserver-docs/images/bookstack-logo500x500.png)](https://github.com/BookStackApp/BookStack) + +## 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=bookstack \ + -e PUID=1001 \ + -e PGID=1001 \ + -e DB_HOST= \ + -e DB_USER= \ + -e DB_PASS= \ + -e DB_DATABASE=bookstackapp \ + -p 6875:80 \ + -v :/config \ + linuxserver/bookstack +``` + + +### docker-compose + +Compatible with docker-compose v2 schemas. + +``` +--- +version: "2" +services: + bookstack: + image: linuxserver/bookstack + container_name: bookstack + environment: + - PUID=1001 + - PGID=1001 + - DB_HOST= + - DB_USER= + - DB_PASS= + - DB_DATABASE=bookstackapp + volumes: + - :/config + ports: + - 6875:80 + mem_limit: 4096m + restart: unless-stopped +``` + +## Parameters + +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. + +| Parameter | Function | +| :----: | --- | +| `-p 80` | will map the container's port 80 to port 6875 on the host | +| `-e PUID=1001` | for UserID - see below for explanation | +| `-e PGID=1001` | for GroupID - see below for explanation | +| `-e DB_HOST=` | for specifying the database host | +| `-e DB_USER=` | for specifying the database user | +| `-e DB_PASS=` | for specifying the database password | +| `-e DB_DATABASE=bookstackapp` | for specifying the database to be used | +| `-v /config` | this will store any uploaded data on the docker host | + +## User / Group Identifiers + +When using 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 any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic. + +In this instance `PUID=1001` and `PGID=1001`, to find yours use `id user` as below: + +``` + $ id username + uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup) +``` + +  +## Application Setup + +This application is dependent on an SQL database be it one you already have or a new one. If you do not already have one, set up our MariaDB container. + +Once the MariaDB container is deployed, you can enter the following commands into the shell of the MariaDB container to create the user, password and database that the app will then use. Replace myuser/mypassword with your own data. + +**Note** this will allow any user with these credentials to connect to the server, it is not limited to localhost + +``` +from shell: mysql -u root -p +CREATE DATABASE bookstackapp; +GRANT USAGE ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword'; +GRANT ALL privileges ON 'bookstackapp'.* TO 'myuser'@localhost; +FLUSH PRIVILEGES; +``` + +Once you have completed these, you can then use the docker run command to create your BookStack container. Make sure you replace things such as with the correct data. + +Then docker start bookstackapp to start the container. You should then be able to access the container at http://dockerhost:6875 + +Default username is admin@admin.com with password of **password** + +Documentation can be found at https://www.bookstackapp.com/docs/ + + + +## Support Info + +* Shell access whilst the container is running: `docker exec -it bookstack /bin/bash` +* To monitor the logs of the container in realtime: `docker logs -f bookstack` +* container version number + * `docker inspect -f '{{ index .Config.Labels "build_version" }}' bookstack` +* image version number + * `docker inspect -f '{{ index .Config.Labels "build_version" }}' linuxserver/bookstack` + +## Versions + +* **02.07.18:** - Initial Release. diff --git a/READMETEMPLATE.md b/READMETEMPLATE.md deleted file mode 100644 index d827c2c..0000000 --- a/READMETEMPLATE.md +++ /dev/null @@ -1,127 +0,0 @@ - -[linuxserverurl]: https://linuxserver.io -[forumurl]: https://discourse.linuxserver.io -[ircurl]: https://www.linuxserver.io/irc/ -[appurl]: https://www.bookstackapp.com -[dockerfileurl]: https://github.com/linuxserver/docker-bookstack/blob/master/Dockerfile -[hub]: https://hub.docker.com/r// - -[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png?v=4&s=4000)][linuxserverurl] - -## Contact information:- - -| Type | Address/Details | -| :---: | --- | -| Discord | [Discord](https://discord.gg/YWrKVTn) | -| Forum | [Linuserver.io forum][forumurl] | - -  -  - -The [LinuxServer.io][linuxserverurl] team brings you another image release featuring :- - - + regular and timely application updates - + easy user mappings - + 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 - + security updates - -# docker-bookstack - -[![Dockerfile-link](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/Dockerfile-Link-green.png)][dockerfileurl] - -[BookStack](https://www.bookstackapp.com) is a free and open source Wiki designed for creating beautiful documentation. Feautring a simple, but powerful WYSIWYG editor it allows for teams to create detailed and useful documentation with ease. - -Powered by SQL and including a Markdown editor for those who prefer it, BookStack is geared towards making documentation more of a pleasure than a chore. - -For more information on BookStack visit their website and check it out: https://www.bookstackapp.com - -## Usage - -This container depends on an SQL server to provide the storage database. If you have one set up already (Docker or otherwise) then continue but if not then deploy a MariaDB container from [this dockerhub page](https://hub.docker.com/r/linuxserver/mariadb/) -``` -docker create \ - --name=bookstackapp \ - -v :/config \ - -e PGID= -e PUID= \ - -e DB_HOST= \ - -e DB_USER= \ - -e DB_PASS= \ - -e DB_DATABASE=bookstackapp - -p 6875:80 \ - docker-bookstack -``` - -It is strongly recommended that this container is used with our LetsEncrypt container so that your BookStack app is served over valid HTTPS. - -## Parameters - -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. - -| Parameter | Function | -| :---: | --- | -| `-p 6875:80` | will map the container's port 80 to port 6875 on the host | -| `-v /config` | this will store any uploaded data on the docker host | -| `-e PGID` | for GroupID, see below for explanation | -| `-e PUID` | for UserID, see below for explanation | -| `-e DB_HOST` | for specifying the database host, see below for further explanation | -| `-e DB_USER ` | for specifying the database user | -| `-e DB_PASS ` | for specifying the database password | -| `-e DB_DATABASE ` | for specifying the database to be used | - - -## User / Group Identifiers - -Sometimes when using 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 any volume directories on the host are owned by the same user you specify and it will "just work" ™. - -In this instance `PUID=1001` and `PGID=1001`, to find yours use `id user` as below: - -``` - $ id - uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup) -``` - -## Setting up the application - -This application is dependent on an SQL database be it one you already have or a new one. If you do not already have one, set up our MariaDB container. - -Once the MariaDB container is deployed, you can enter the following commands into the shell of the MariaDB container to create the user, password and database that the app will then use. Replace myuser/mypassword with your own data. - -**Note** this will allow any user with these credentials to connect to the server, it is not limited to localhost - -` -from shell: mysql -u root -p -CREATE DATABASE bookstackapp; -GRANT USAGE ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword'; -GRANT ALL privileges ON 'bookstackapp'.* TO 'myuser'@localhost; -FLUSH PRIVILEGES; -` - -Once you have completed these, you can then use the docker run command to create your BookStack container. Make sure you replace things such as with the correct data. - -Then docker start bookstackapp to start the container. You should then be able to access the container at http://dockerhost:6875 - -Default username is admin@admin.com with password of **password** - -Documentation can be found at https://www.bookstackapp.com/docs/ - -## Container access and information. - -| Function | Command | -| :--- | :--- | -| Shell access (live container) | `docker exec -it /bin/bash` | -| Realtime container logs | `docker logs -f ` | -| Container version | `docker inspect -f '{{ index .Config.Labels "build_version" }}' ` | -| Image version | `docker inspect -f '{{ index .Config.Labels "build_version" }}' ` | -| Dockerfile | [Dockerfile][dockerfileurl] | - -## Changelog - -| Date | Changes | -| :---: | --- | -| 02.07.18 | Initial Release. | diff --git a/readme-vars.yml b/readme-vars.yml new file mode 100644 index 0000000..228071f --- /dev/null +++ b/readme-vars.yml @@ -0,0 +1,64 @@ +--- + +# project information +project_name: bookstack +project_url: "https://github.com/BookStackApp/BookStack" +project_logo: "https://s3-us-west-2.amazonaws.com/linuxserver-docs/images/bookstack-logo500x500.png" +project_blurb: | + [{{ project_name|capitalize }}]({{ project_url }}) is a free and open source Wiki designed for creating beautiful documentation. Feautring a simple, but powerful WYSIWYG editor it allows for teams to create detailed and useful documentation with ease. + + Powered by SQL and including a Markdown editor for those who prefer it, BookStack is geared towards making documentation more of a pleasure than a chore. + + For more information on BookStack visit their website and check it out: https://www.bookstackapp.com +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 +param_container_name: "{{ project_name }}" +param_usage_include_vols: true +param_volumes: + - { vol_path: "/config", vol_host_path: "", desc: "this will store any uploaded data on the docker host" } +param_usage_include_env: true +param_env_vars: + - { env_var: "DB_HOST", env_value: "", desc: "for specifying the database host" } + - { env_var: "DB_USER", env_value: "", desc: "for specifying the database user" } + - { env_var: "DB_PASS", env_value: "", desc: "for specifying the database password" } + - { env_var: "DB_DATABASE", env_value: "bookstackapp", desc: "for specifying the database to be used" } + +param_usage_include_ports: true +param_ports: + - { external_port: "6875", internal_port: "80", port_desc: "will map the container's port 80 to port 6875 on the host" } + +# application setup block +app_setup_block_enabled: true +app_setup_block: | + This application is dependent on an SQL database be it one you already have or a new one. If you do not already have one, set up our MariaDB container. + + Once the MariaDB container is deployed, you can enter the following commands into the shell of the MariaDB container to create the user, password and database that the app will then use. Replace myuser/mypassword with your own data. + + **Note** this will allow any user with these credentials to connect to the server, it is not limited to localhost + + ``` + from shell: mysql -u root -p + CREATE DATABASE bookstackapp; + GRANT USAGE ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword'; + GRANT ALL privileges ON 'bookstackapp'.* TO 'myuser'@localhost; + FLUSH PRIVILEGES; + ``` + + Once you have completed these, you can then use the docker run command to create your BookStack container. Make sure you replace things such as with the correct data. + + Then docker start bookstackapp to start the container. You should then be able to access the container at http://dockerhost:6875 + + Default username is admin@admin.com with password of **password** + + Documentation can be found at https://www.bookstackapp.com/docs/ + +# changelog +changelogs: + - { date: "02.07.18:", desc: "Initial Release." }