mirror of
https://github.com/vanilla-wiiu/vanilla.git
synced 2026-10-28 09:43:51 +00:00
docker: add convenience scripts for maintainers
This commit is contained in:
1 parent
9744e7de23
commit
ff354e4176
2 files changed
+60
No files matched your search
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This is a convenience script for maintainers to locally build a Docker image
|
||||
# and push its BuildKit cache for use by the CI.
|
||||
#
|
||||
# The script assumes you have authenticated with `docker login ghcr.io`
|
||||
set -e
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Usage: $0 <os> <arch> (e.g. linux x86_64)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OS="$1"
|
||||
ARCH="$2"
|
||||
IMAGE="ghcr.io/vanilla-wiiu/vanilla-${OS}-${ARCH}"
|
||||
LOCAL_IMAGE="vanilla-${OS}-${ARCH}"
|
||||
SCRIPT_DIR=$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")
|
||||
|
||||
docker buildx build \
|
||||
-f "${SCRIPT_DIR}/${OS}/Dockerfile" \
|
||||
--build-arg ARCH="${ARCH}" \
|
||||
-t "${LOCAL_IMAGE}" \
|
||||
--label "org.opencontainers.image.source=https://github.com/vanilla-wiiu/vanilla" \
|
||||
--load \
|
||||
--cache-from "type=registry,ref=${IMAGE}:buildcache" \
|
||||
--cache-to "type=registry,ref=${IMAGE}:buildcache,mode=max" \
|
||||
"${SCRIPT_DIR}/.."
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This is a convenience script for importing the CI's BuildKit cache, loading a
|
||||
# runnable image locally, and using it to build Vanilla.
|
||||
#
|
||||
# The script assumes you have authenticated with `docker login ghcr.io`
|
||||
set -e
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Usage: $0 <os> <arch> (e.g. linux x86_64)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OS="$1"
|
||||
ARCH="$2"
|
||||
IMAGE="ghcr.io/vanilla-wiiu/vanilla-${OS}-${ARCH}"
|
||||
LOCAL_IMAGE="vanilla-${OS}-${ARCH}"
|
||||
SCRIPT_DIR=$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")
|
||||
ROOT="${SCRIPT_DIR}/.."
|
||||
|
||||
docker buildx build \
|
||||
-f "${SCRIPT_DIR}/${OS}/Dockerfile" \
|
||||
--build-arg ARCH="${ARCH}" \
|
||||
-t "${LOCAL_IMAGE}" \
|
||||
--load \
|
||||
--cache-from "type=registry,ref=${IMAGE}:buildcache" \
|
||||
"${ROOT}"
|
||||
|
||||
docker run --rm \
|
||||
-v "${ROOT}":/vanilla \
|
||||
-v "${ROOT}/install":/install \
|
||||
"${LOCAL_IMAGE}"
|
||||
Reference in new issue
Block a user