Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions .github/workflows/build-multiarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,61 +13,69 @@ on:

jobs:
build:
if: github.repository == 'itzg/docker-minecraft-server'
strategy:
fail-fast: false
matrix:
variant:
- java17
- java17-openj9
- java17-alpine
- java8
- java8-multiarch
- java8-openj9
- java11
- java11-openj9
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: java17-alpine
baseImage: eclipse-temurin:17-jdk-alpine
platforms: linux/amd64
mcVersion: LATEST
- variant: java8
baseImage: openjdk:8-jdk-alpine3.8
platforms: linux/amd64
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:
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
uses: actions/checkout@v2.4.0
with:
# for build-files step
fetch-depth: 0

- name: Docker meta
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 }}
Expand All @@ -89,6 +97,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:
Expand All @@ -101,6 +114,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

Expand All @@ -122,5 +136,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 }}
97 changes: 0 additions & 97 deletions .github/workflows/main.yml

This file was deleted.

47 changes: 0 additions & 47 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,57 +79,10 @@ 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:

```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
```
35 changes: 10 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,16 @@
# 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
# 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=${BUILD_FILES_REV} /build/run.sh install-packages

RUN --mount=target=/build,source=build \
REV=${BUILD_FILES_REV} /build/run.sh setup-user

COPY --chmod=644 files/sudoers* /etc/sudoers.d

Expand Down
26 changes: 26 additions & 0 deletions build/alpine/install-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

set -e

apk add --no-cache -U \
openssl \
imagemagick \
file \
lsof \
su-exec \
coreutils \
findutils \
shadow \
bash \
curl iputils \
git \
jq \
mysql-client \
tzdata \
rsync \
nano \
sudo \
knock \
ttf-dejavu \
tar \
zstd
6 changes: 6 additions & 0 deletions build/alpine/setup-user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

set -e

addgroup -g 1000 minecraft
adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft
7 changes: 7 additions & 0 deletions build/run.sh
Original file line number Diff line number Diff line change
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice folder shim!

28 changes: 28 additions & 0 deletions build/ubuntu/install-packages.sh
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions build/ubuntu/setup-user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

set -e

addgroup --gid 1000 minecraft
adduser --system --shell /bin/false --uid 1000 --ingroup minecraft --home /data minecraft
Loading