Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: accept build args for extra packages to install #3060

Merged
merged 1 commit into from
Sep 7, 2024
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
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT

# The following three arg/env vars get used by the platform specific "install-packages" script
ARG EXTRA_DEB_PACKAGES=""
ARG EXTRA_DNF_PACKAGES=""
ARG EXTRA_ALPINE_PACKAGES=""
ARG FORCE_INSTALL_PACKAGES=1
RUN --mount=target=/build,source=build \
TARGET=${TARGETARCH}${TARGETVARIANT} /build/run.sh install-packages
TARGET=${TARGETARCH}${TARGETVARIANT} \
/build/run.sh install-packages

RUN --mount=target=/build,source=build \
/build/run.sh setup-user
Expand Down
4 changes: 3 additions & 1 deletion build/alpine/install-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -e
set -o pipefail

# Install necessary packages
# shellcheck disable=SC2086
apk add --no-cache -U \
openssl \
imagemagick \
Expand All @@ -29,7 +30,8 @@ apk add --no-cache -U \
nfs-utils \
libpcap \
libwebp \
libcap
libcap \
${EXTRA_ALPINE_PACKAGES}

# Download and install patched knockd
curl -fsSL -o /tmp/knock.tar.gz https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-alpine-amd64.tar.gz
Expand Down
4 changes: 3 additions & 1 deletion build/ol/install-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ EOF
dnf update -y

# Install necessary packages
# shellcheck disable=SC2086
dnf install -y \
ImageMagick \
file \
Expand All @@ -44,7 +45,8 @@ dnf install -y \
libpcap \
libwebp \
findutils \
which
which \
${EXTRA_DNF_PACKAGES}

# Install Git LFS
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash
Expand Down
4 changes: 3 additions & 1 deletion build/ubuntu/install-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -euo pipefail

# Update and install packages
apt-get update
# shellcheck disable=SC2086
DEBIAN_FRONTEND=noninteractive \
apt-get install -y \
imagemagick \
Expand All @@ -26,7 +27,8 @@ apt-get install -y \
zstd \
lbzip2 \
nfs-common \
libpcap0.8
libpcap0.8 \
${EXTRA_DEB_PACKAGES}

# Install Git LFS
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
Expand Down
8 changes: 8 additions & 0 deletions docs/misc/contributing/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,11 @@ or just a plain build
```shell
docker build -t IMG_PREFIX/minecraft-server .
```

## Installing extra packages

The following build args can be set to install additional packages for the respective base image distro:

- `EXTRA_DEB_PACKAGES`
- `EXTRA_DNF_PACKAGES`
- `EXTRA_ALPINE_PACKAGES`