From 0896d265d12c9aba170aa78e883ab16e9a0eacce Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Tue, 8 Feb 2022 21:52:23 -0600 Subject: [PATCH 01/12] build: add alpine support to matrix builds --- .github/workflows/build-multiarch.yml | 11 ++++----- Dockerfile | 34 +++++++-------------------- build/alpine/install-packages.sh | 24 +++++++++++++++++++ build/alpine/setup-user.sh | 6 +++++ build/get-distro.sh | 3 +++ build/ubuntu/install-packages.sh | 28 ++++++++++++++++++++++ build/ubuntu/setup-user.sh | 6 +++++ scripts/start | 18 +++++++++----- scripts/start-utils | 6 ++++- 9 files changed, 98 insertions(+), 38 deletions(-) create mode 100755 build/alpine/install-packages.sh create mode 100755 build/alpine/setup-user.sh create mode 100755 build/get-distro.sh create mode 100644 build/ubuntu/install-packages.sh create mode 100644 build/ubuntu/setup-user.sh diff --git a/.github/workflows/build-multiarch.yml b/.github/workflows/build-multiarch.yml index bcc9ce09997..f5ee5c01395 100644 --- a/.github/workflows/build-multiarch.yml +++ b/.github/workflows/build-multiarch.yml @@ -20,6 +20,7 @@ jobs: variant: - java17 - java17-openj9 + - java8 - java8-multiarch - java8-openj9 - java11 @@ -27,32 +28,30 @@ jobs: include: - variant: java17 baseImage: eclipse-temurin:17 - tagPrefix: java17- platforms: linux/amd64,linux/arm/v7,linux/arm64 mcVersion: LATEST - variant: java17-openj9 baseImage: ibm-semeru-runtimes:open-17-jdk - tagPrefix: java17-openj9- platforms: linux/amd64,linux/arm64 mcVersion: LATEST + - variant: java8 + baseImage: openjdk:8-jdk-alpine3.8 + platforms: linux/amd64,linux/arm/v6 + mcVersion: 1.12.2 - variant: java8-multiarch baseImage: eclipse-temurin:8-jdk - tagPrefix: java8- platforms: linux/amd64,linux/arm64 mcVersion: 1.12.2 - variant: java8-openj9 baseImage: ibm-semeru-runtimes:open-8-jdk - tagPrefix: java8-openj9- platforms: linux/amd64,linux/arm64 mcVersion: 1.12.2 - variant: java11 baseImage: adoptopenjdk:11-jdk-hotspot - tagPrefix: java11- platforms: linux/amd64,linux/arm/v7,linux/arm64 mcVersion: 1.16.5 - variant: java11-openj9 baseImage: ibm-semeru-runtimes:open-11-jdk - tagPrefix: java11-openj9- platforms: linux/amd64,linux/arm64 mcVersion: 1.16.5 env: diff --git a/Dockerfile b/Dockerfile index e9c33f6276e..ed5eff2a843 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,31 +1,15 @@ +# syntax = docker/dockerfile:1.3 + ARG BASE_IMAGE=eclipse-temurin:17-jdk FROM ${BASE_IMAGE} -RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive \ - apt-get install -y \ - imagemagick \ - file \ - gosu \ - sudo \ - net-tools \ - iputils-ping \ - curl \ - git \ - jq \ - dos2unix \ - mysql-client \ - tzdata \ - rsync \ - nano \ - unzip \ - zstd \ - knockd \ - ttf-dejavu \ - && apt-get clean - -RUN addgroup --gid 1000 minecraft \ - && adduser --system --shell /bin/false --uid 1000 --ingroup minecraft --home /data minecraft +RUN --mount=target=/build,source=build \ + distro=$(/build/get-distro.sh) && \ + /build/${distro}/install-packages.sh + +RUN --mount=target=/build,source=build \ + distro=$(/build/get-distro.sh) && \ + /build/${distro}/setup-user.sh COPY --chmod=644 files/sudoers* /etc/sudoers.d diff --git a/build/alpine/install-packages.sh b/build/alpine/install-packages.sh new file mode 100755 index 00000000000..48b4185ebb0 --- /dev/null +++ b/build/alpine/install-packages.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +set -e + +apk add --no-cache -U \ + openssl \ + imagemagick \ + file \ + lsof \ + su-exec \ + findutils \ + shadow \ + bash \ + curl iputils \ + git \ + jq \ + mysql-client \ + tzdata \ + rsync \ + nano \ + sudo \ + knock \ + ttf-dejavu \ + zstd \ No newline at end of file diff --git a/build/alpine/setup-user.sh b/build/alpine/setup-user.sh new file mode 100755 index 00000000000..c84bf861cba --- /dev/null +++ b/build/alpine/setup-user.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +set -e + +addgroup -g 1000 minecraft +adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft diff --git a/build/get-distro.sh b/build/get-distro.sh new file mode 100755 index 00000000000..b7b29c75b8e --- /dev/null +++ b/build/get-distro.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +cat /etc/os-release | grep -E "^ID=" | cut -d= -f2 | sed -e 's/"//g' \ No newline at end of file diff --git a/build/ubuntu/install-packages.sh b/build/ubuntu/install-packages.sh new file mode 100644 index 00000000000..f37d946d693 --- /dev/null +++ b/build/ubuntu/install-packages.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +apt-get update + +DEBIAN_FRONTEND=noninteractive \ +apt-get install -y \ + imagemagick \ + file \ + gosu \ + sudo \ + net-tools \ + iputils-ping \ + curl \ + git \ + jq \ + dos2unix \ + mysql-client \ + tzdata \ + rsync \ + nano \ + unzip \ + zstd \ + knockd \ + ttf-dejavu + +apt-get clean \ No newline at end of file diff --git a/build/ubuntu/setup-user.sh b/build/ubuntu/setup-user.sh new file mode 100644 index 00000000000..462f56b3561 --- /dev/null +++ b/build/ubuntu/setup-user.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +set -e + +addgroup --gid 1000 minecraft +adduser --system --shell /bin/false --uid 1000 --ingroup minecraft --home /data minecraft \ No newline at end of file diff --git a/scripts/start b/scripts/start index 95c2736e64b..b8f2c6301cf 100755 --- a/scripts/start +++ b/scripts/start @@ -1,11 +1,12 @@ #!/bin/bash -. ${SCRIPTS:-/}start-utils +# shellcheck source=start-utils +. "${SCRIPTS:-/}start-utils" umask 0002 chmod g+w /data -if ! isTrue "${SKIP_SUDO:-false}" && [ $(id -u) = 0 ]; then +if ! isTrue "${SKIP_SUDO:-false}" && [ "$(id -u)" = 0 ]; then runAsUser=minecraft runAsGroup=minecraft @@ -24,14 +25,14 @@ if ! isTrue "${SKIP_SUDO:-false}" && [ $(id -u) = 0 ]; then if [[ $GID != 0 ]]; then if [[ $GID != $(id -g minecraft) ]]; then log "Changing gid of minecraft to $GID" - groupmod -o -g $GID minecraft + groupmod -o -g "$GID" minecraft fi else runAsGroup=root fi fi - if [[ $(stat -c "%u" /data) != $UID ]]; then + if [[ $(stat -c "%u" /data) != "$UID" ]]; then log "Changing ownership of /data to $UID ..." chown -R ${runAsUser}:${runAsGroup} /data fi @@ -40,7 +41,12 @@ if ! isTrue "${SKIP_SUDO:-false}" && [ $(id -u) = 0 ]; then echo 'hosts: files dns' > /etc/nsswitch.conf fi - exec gosu ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration "$@" + distro=$(getDistro) + if [[ $distro == alpine ]]; then + exec su-exec ${runAsUser}:${runAsGroup} "${SCRIPTS:-/}start-configuration" "$@" + else + exec gosu ${runAsUser}:${runAsGroup} "${SCRIPTS:-/}start-configuration" "$@" + fi else - exec ${SCRIPTS:-/}start-configuration "$@" + exec "${SCRIPTS:-/}start-configuration" "$@" fi diff --git a/scripts/start-utils b/scripts/start-utils index cdce61be577..15d04eb0e6c 100755 --- a/scripts/start-utils +++ b/scripts/start-utils @@ -237,11 +237,15 @@ function extract() { esac } +function getDistro() { + cat /etc/os-release | grep -E "^ID=" | cut -d= -f2 | sed -e 's/"//g' +} + function checkSum() { local sum_file=${1?} # Get distro - distro=$(cat /etc/os-release | grep -E "^ID=" | cut -d= -f2 | sed -e 's/"//g') + distro=$(getDistro) if [ "${distro}" == "debian" ] && sha1sum -c "${sum_file}" --status 2> /dev/null; then return 0 From 876baa7ef0485b477ae75abaef385d3ce7b5dc13 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Tue, 8 Feb 2022 21:54:31 -0600 Subject: [PATCH 02/12] fixed execute permissions --- build/ubuntu/install-packages.sh | 0 build/ubuntu/setup-user.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build/ubuntu/install-packages.sh mode change 100644 => 100755 build/ubuntu/setup-user.sh diff --git a/build/ubuntu/install-packages.sh b/build/ubuntu/install-packages.sh old mode 100644 new mode 100755 diff --git a/build/ubuntu/setup-user.sh b/build/ubuntu/setup-user.sh old mode 100644 new mode 100755 From 8d89a3d535d732d04fac888c7d77f6371ece40af Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Tue, 8 Feb 2022 21:56:29 -0600 Subject: [PATCH 03/12] added application/x-zstd --- scripts/start-utils | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/start-utils b/scripts/start-utils index 15d04eb0e6c..9f310b8dc80 100755 --- a/scripts/start-utils +++ b/scripts/start-utils @@ -227,7 +227,7 @@ function extract() { application/zip) unzip -q -d "${destDir}" "${src}" ;; - application/x-tar|application/gzip|application/x-gzip|application/x-bzip2|application/zstd) + application/x-tar|application/gzip|application/x-gzip|application/x-bzip2|application/zstd|application/x-zstd) tar -C "${destDir}" -xf "${src}" ;; *) From f04fd57ce97b0b125231591e69e7b55cd1bb8cb1 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Tue, 8 Feb 2022 21:58:42 -0600 Subject: [PATCH 04/12] added java17-alpine --- .github/workflows/build-multiarch.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build-multiarch.yml b/.github/workflows/build-multiarch.yml index f5ee5c01395..3834b2d141c 100644 --- a/.github/workflows/build-multiarch.yml +++ b/.github/workflows/build-multiarch.yml @@ -20,6 +20,7 @@ jobs: variant: - java17 - java17-openj9 + - java17-alpine - java8 - java8-multiarch - java8-openj9 @@ -34,6 +35,10 @@ jobs: baseImage: ibm-semeru-runtimes:open-17-jdk platforms: linux/amd64,linux/arm64 mcVersion: LATEST + - variant: java17-alpine + baseImage: eclipse-temurin:17-jdk-alpine + platforms: linux/amd64 + mcVersion: LATEST - variant: java8 baseImage: openjdk:8-jdk-alpine3.8 platforms: linux/amd64,linux/arm/v6 From 128d4033190a23730d0072b6bacf57d7d0cd1bed Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Tue, 8 Feb 2022 22:00:28 -0600 Subject: [PATCH 05/12] install tar package for zstd support --- build/alpine/install-packages.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build/alpine/install-packages.sh b/build/alpine/install-packages.sh index 48b4185ebb0..33c29f7e3a4 100755 --- a/build/alpine/install-packages.sh +++ b/build/alpine/install-packages.sh @@ -21,4 +21,5 @@ apk add --no-cache -U \ sudo \ knock \ ttf-dejavu \ + tar \ zstd \ No newline at end of file From 5cc9ab57a99cc4e8ced658057a6ebf062bc01074 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 9 Feb 2022 21:36:03 -0600 Subject: [PATCH 06/12] Ensured RUN for packages and setup-user were cache-able --- Dockerfile | 6 ++---- build/alpine/install-packages.sh | 1 + build/get-distro.sh | 3 --- build/run.sh | 7 +++++++ tests/setuponlytests/test.sh | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) delete mode 100755 build/get-distro.sh create mode 100755 build/run.sh diff --git a/Dockerfile b/Dockerfile index ed5eff2a843..96bb61f3e29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,12 +4,10 @@ ARG BASE_IMAGE=eclipse-temurin:17-jdk FROM ${BASE_IMAGE} RUN --mount=target=/build,source=build \ - distro=$(/build/get-distro.sh) && \ - /build/${distro}/install-packages.sh + REV=1 /build/run.sh install-packages RUN --mount=target=/build,source=build \ - distro=$(/build/get-distro.sh) && \ - /build/${distro}/setup-user.sh + REV=1 /build/run.sh setup-user COPY --chmod=644 files/sudoers* /etc/sudoers.d diff --git a/build/alpine/install-packages.sh b/build/alpine/install-packages.sh index 33c29f7e3a4..b567088ac27 100755 --- a/build/alpine/install-packages.sh +++ b/build/alpine/install-packages.sh @@ -8,6 +8,7 @@ apk add --no-cache -U \ file \ lsof \ su-exec \ + coreutils \ findutils \ shadow \ bash \ diff --git a/build/get-distro.sh b/build/get-distro.sh deleted file mode 100755 index b7b29c75b8e..00000000000 --- a/build/get-distro.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -cat /etc/os-release | grep -E "^ID=" | cut -d= -f2 | sed -e 's/"//g' \ No newline at end of file diff --git a/build/run.sh b/build/run.sh new file mode 100755 index 00000000000..d2a41cb50b7 --- /dev/null +++ b/build/run.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +distro=$(cat /etc/os-release | grep -E "^ID=" | cut -d= -f2 | sed -e 's/"//g') + +"$(dirname "$0")/${distro}/$1".sh \ No newline at end of file diff --git a/tests/setuponlytests/test.sh b/tests/setuponlytests/test.sh index 748b31adf46..4c0ca2793d1 100644 --- a/tests/setuponlytests/test.sh +++ b/tests/setuponlytests/test.sh @@ -40,7 +40,7 @@ $logs echo "${folder} PASS" fi - docker-compose down -v --remove-orphans + docker-compose down -v --remove-orphans > /dev/null cd .. return $result From e51f4e8adeb6d3b2bdefe276b717162363bfe220 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 9 Feb 2022 21:46:44 -0600 Subject: [PATCH 07/12] Removed arm/v6 --- .github/workflows/build-multiarch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-multiarch.yml b/.github/workflows/build-multiarch.yml index 3834b2d141c..36df13275c9 100644 --- a/.github/workflows/build-multiarch.yml +++ b/.github/workflows/build-multiarch.yml @@ -41,7 +41,7 @@ jobs: mcVersion: LATEST - variant: java8 baseImage: openjdk:8-jdk-alpine3.8 - platforms: linux/amd64,linux/arm/v6 + platforms: linux/amd64 mcVersion: 1.12.2 - variant: java8-multiarch baseImage: eclipse-temurin:8-jdk From 8dc0889f0b95d91a0af0278fd70ddd5bd496069f Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 10 Feb 2022 08:12:55 -0600 Subject: [PATCH 08/12] Added BUILD_FILES_REV to Dockerfile --- Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 96bb61f3e29..e5bb4c0251d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,11 +3,14 @@ ARG BASE_IMAGE=eclipse-temurin:17-jdk FROM ${BASE_IMAGE} +# CI system should set this to a hash or git revision of the build directory and it's contents to +# ensure consistent cache updates. +ARG BUILD_FILES_REV=1 RUN --mount=target=/build,source=build \ - REV=1 /build/run.sh install-packages + REV=${BUILD_FILES_REV} /build/run.sh install-packages RUN --mount=target=/build,source=build \ - REV=1 /build/run.sh setup-user + REV=${BUILD_FILES_REV} /build/run.sh setup-user COPY --chmod=644 files/sudoers* /etc/sudoers.d From e15d7e0b7bbc049762c55b8f7732182ad281f2c5 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 10 Feb 2022 08:23:10 -0600 Subject: [PATCH 09/12] Calculate BUILD_FILES_REV --- .github/workflows/build-multiarch.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build-multiarch.yml b/.github/workflows/build-multiarch.yml index 36df13275c9..72439a81788 100644 --- a/.github/workflows/build-multiarch.yml +++ b/.github/workflows/build-multiarch.yml @@ -93,6 +93,11 @@ jobs: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Calculate build files revision + id: build-files + run: | + echo "::set-output name=REV::$(git log -1 --format=%H build)" + - name: Build for test uses: docker/build-push-action@v2.9.0 with: @@ -105,6 +110,7 @@ jobs: push: false build-args: | BASE_IMAGE=${{ matrix.baseImage }} + BUILD_FILES_REV=${{ steps.build-files.outputs.REV }} cache-from: type=gha,scope=${{ matrix.variant }} # no cache-to to avoid cross-cache update from next build step @@ -126,5 +132,6 @@ jobs: labels: ${{ steps.meta.outputs.labels }} build-args: | BASE_IMAGE=${{ matrix.baseImage }} + BUILD_FILES_REV=${{ steps.build-files-rev.outputs.REV }} cache-from: type=gha,scope=${{ matrix.variant }} cache-to: type=gha,mode=max,scope=${{ matrix.variant }} From 363ca2367a052d58f5288498652888d6c8794076 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 10 Feb 2022 08:27:26 -0600 Subject: [PATCH 10/12] Needs more git history to calculate BUILD_FILES_REV --- .github/workflows/build-multiarch.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-multiarch.yml b/.github/workflows/build-multiarch.yml index 72439a81788..848f53be2f4 100644 --- a/.github/workflows/build-multiarch.yml +++ b/.github/workflows/build-multiarch.yml @@ -65,6 +65,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2.4.0 + with: + # for build-files step + fetch-depth: 0 - name: Docker meta id: meta From 0d8610b6e2121a91c5fd852b036fdc4102e31a5e Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 10 Feb 2022 18:22:20 -0600 Subject: [PATCH 11/12] Removed unneeded info for branch management --- .github/workflows/main.yml | 97 ------------------------ DEVELOPMENT.md | 47 ------------ docker-versions-create.sh | 151 ------------------------------------- 3 files changed, 295 deletions(-) delete mode 100644 .github/workflows/main.yml delete mode 100755 docker-versions-create.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 621af08a261..00000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Build and Publish - -on: - push: - branches: - - java8 - - openj9 - - openj9-11 - - adopt11 - - test/alpine/* - tags: - - "[0-9]+.[0-9]+.[0-9]+-java8" - - "[0-9]+.[0-9]+.[0-9]+-openj9" - - "[0-9]+.[0-9]+.[0-9]+-openj9-11" - - "[0-9]+.[0-9]+.[0-9]+-openj9-nightly" - - "[0-9]+.[0-9]+.[0-9]+-adopt11" - -env: - IMAGE_TO_TEST: itzg/minecraft-server:test-${{ github.repository_owner }}-${{ github.run_id }} - -jobs: - build: - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v2.4.0 - - - name: Prepare - id: prep - run: | - DOCKER_IMAGE=itzg/minecraft-server - VERSION=edge - if [[ $GITHUB_REF == refs/tags/* ]]; then - VERSION=${GITHUB_REF#refs/tags/} - fi - if [[ $GITHUB_REF == refs/heads/* ]]; then - VERSION=${GITHUB_REF#refs/heads/} - if [[ $VERSION == master ]]; then - VERSION=latest - fi - fi - TAGS="${DOCKER_IMAGE}:${VERSION//\//-}" - echo ::set-output name=tags::${TAGS} - echo ::set-output name=version::${VERSION//\//-} - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build for test - uses: docker/build-push-action@v2.9.0 - if: github.ref_name == 'java8' - with: - context: . - platforms: linux/amd64 - tags: ${{ env.IMAGE_TO_TEST }} - # ensure latest base image is used - pull: true - load: true - push: false - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Run tests - if: github.ref_name == 'java8' - run: | - tests/test.sh - env: - MINECRAFT_VERSION: 1.12.2 - - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2.9.0 - with: - context: . - file: ./Dockerfile - # ensure latest base image is used - pull: true - # publish - push: true - # tags determined by prep step - tags: ${{ steps.prep.outputs.tags }} - cache-from: type=gha - cache-to: type=gha,mode=max - labels: | - org.opencontainers.image.documentation=https://github.com/itzg/docker-minecraft-server - org.opencontainers.image.version=${{ steps.prep.outputs.version }} - org.opencontainers.image.source=https://github.com/itzg/docker-minecraft-server - org.opencontainers.image.revision=${{ github.sha }} - - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index ce2df0386ce..a81df3785a2 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -79,31 +79,6 @@ Note the port that was selected by http-server and pass the build arguments, suc Now the image can be built like normal and it will install mc-image-helper from the locally built copy. -## Multi-base-image variants - -Several base-image variants are maintained in order to offer choices in JDK provider and version. The variants are maintained in their respective branches: -- openj9 -- openj9-nightly -- adopt11 -- adopt13 -- multiarch - -The [docker-versions-create.sh](docker-versions-create.sh) script is configured with the branches to maintain and is used to merge changes from the master branch into the mulit-base variant branches. The script also manages git tagging the master branch along with the merged branches. So a typical use of the script would be like: - -```shell script -./docker-versions-create.sh -s -t 1.2.0 -``` - -> Most often the major version will be bumped unless a bug or hotfix needs to be published in which case the patch version should be incremented. - -> The build and publishing of those branches and their tags is currently performed within Docker Hub. - -## multiarch support - -The [multiarch branch](https://github.com/itzg/docker-minecraft-server/tree/multiarch) supports running the image on amd64, arm64, and armv7 (aka RaspberryPi). Unlike the mainline branches, it is based on Ubuntu 18.04 since the openjdk package provided by Ubuntu includes full JIT support on all of the processor types. - -The multiarch images are built and published by [a Github action](https://github.com/itzg/docker-minecraft-server/actions?query=workflow%3A%22Build+and+publish+multiarch%22), which [is configured in that branch](https://github.com/itzg/docker-minecraft-server/blob/multiarch/.github/workflows/build-multiarch.yml). - ## Generating release notes The following git command can be used to provide the bulk of release notes content: @@ -111,25 +86,3 @@ The following git command can be used to provide the bulk of release notes conte ```shell script git log --invert-grep --grep "^ci:" --grep "^misc:" --grep "^docs:" --pretty="* %s" 1.1.0..1.2.0 ``` -## Tracking changes from master without content - -The following script uses the [ours](https://git-scm.com/docs/merge-strategies#Documentation/merge-strategies.txt-ours) merging strategy to track the history from master into the other branches without actually bringing the changes over. It is useful when a change is specific to master only, such as bumping the base Java version for the `latest` image tag. - -```shell -branches=( - java8 - java8-multiarch - java8-openj9 - java11 - java11-openj9 - java16 - java16-openj9 - java17 -) - -for b in "${branches[@]}"; do - git checkout "$b" - git merge -s ours -m "Track latest from master" master - git push origin -done -``` diff --git a/docker-versions-create.sh b/docker-versions-create.sh deleted file mode 100755 index 8eeb7310b8b..00000000000 --- a/docker-versions-create.sh +++ /dev/null @@ -1,151 +0,0 @@ -#!/bin/bash -#set -x -# Use this variable to indicate a list of branches that docker hub is watching -branches_list=( - 'java8' - ) - -function TrapExit { - echo "Checking out back in master" - git checkout master -} - -batchMode=false - -while getopts "hbt:s" arg -do - case $arg in - b) - batchMode=true - ;; - t) - tag=${OPTARG} - ;; - s) - tagArgs="-s -m 'Signed during docker-versions-create" - ;; - h) - echo " -Usage $0 [options] - -Options: - -b enable batch mode, which avoids interactive prompts and causes script to fail immediately - when any merge fails - -t TAG tag and push the current revision on master with the given tag - and apply respective tags to each branch - -s enable signed tags - -h display this help and exit -" - exit - ;; - *) - echo "Unsupported arg $arg" - exit 2 - ;; - esac -done - -${batchMode} && echo "Using batch mode" - -trap TrapExit EXIT SIGTERM - -test -d ./.git || { echo ".git folder was not found. Please start this script from root directory of the project!"; - exit 1; } - -# Making sure we are in master -git checkout master -git pull --all || { echo "Can't pull the repo!"; \ - exit 1; } -if [[ $tag ]]; then - git tag $tag - git push origin $tag -fi - -git_branches=$(git branch -a) - -for branch in "${branches_list[@]}"; do - if [[ "$git_branches" != *"$branch"* ]]; then - echo "Can't update $branch because I can't find it in the list of branches." - exit 1 - else - echo "Branch $branch found. Working with it." - git checkout "$branch" || { echo "Can't checkout into the branch. Don't know the cause."; \ - exit 1; } - proceed='False' - while [[ "$proceed" == "False" ]]; do - # Ensure local branch is aligned with remote since docker-versions-create may have been run elsewhere - git pull - - if git merge -m 'Auto-merging via docker-versions-create' master; then - proceed="True" - echo "Branch $branch updated to current master successfully" - # pushing changes to remote for this branch - git commit -m "Auto merge branch with master" -a - # push may fail if remote doesn't have this branch yet. In this case - sending branch - git push || git push -u origin "$branch" || { echo "Can't push changes to the origin."; exit 1; } - if [[ $tag ]]; then - git tag "$tag-$branch" - git push origin "$tag-$branch" - fi - elif ${batchMode}; then - status=$? - echo "Git merge failed in batch mode" - exit ${status} - # and trap exit gets us back to master - else - cat< Date: Thu, 10 Feb 2022 18:36:06 -0600 Subject: [PATCH 12/12] Removed hardcoded image org --- .github/workflows/build-multiarch.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-multiarch.yml b/.github/workflows/build-multiarch.yml index 848f53be2f4..ceb33931086 100644 --- a/.github/workflows/build-multiarch.yml +++ b/.github/workflows/build-multiarch.yml @@ -13,7 +13,6 @@ on: jobs: build: - if: github.repository == 'itzg/docker-minecraft-server' strategy: fail-fast: false matrix: @@ -60,7 +59,7 @@ jobs: platforms: linux/amd64,linux/arm64 mcVersion: 1.16.5 env: - IMAGE_TO_TEST: itzg/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }} + IMAGE_TO_TEST: ${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }} runs-on: ubuntu-20.04 steps: - name: Checkout @@ -73,8 +72,10 @@ jobs: id: meta uses: docker/metadata-action@v3 with: + # NOTE for forks: if your Docker Hub organization doesn't match your Github repo's, + # then the use of ${{ github.repository_owner }} will need to be replaced. images: | - itzg/minecraft-server + ${{ github.repository_owner }}/minecraft-server tags: | type=ref,event=tag,enable=${{ matrix.variant == 'java17' }} type=ref,event=tag,suffix=-${{ matrix.variant }}