mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-09 02:15:32 +00:00
maint(developer): use docker buildx to build docker images
This change verifies that `docker buildx` is available and then uses that for building the images. For that we apparently need the magic line at the top of the `Dockerfile`s and set the environment variable `DOCKER_BUILDKIT`. This solves a problem building docker images on Linux with an older Docker version where the heredocs didn't work.
This commit is contained in:
parent
739bdf788f
commit
33fe775aa7
8 changed files with 20 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
|||
# syntax=docker/dockerfile:1.4
|
||||
# Keyman is copyright (C) SIL Global. MIT License.
|
||||
|
||||
ARG BASE_VERSION=default
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
# syntax=docker/dockerfile:1.4
|
||||
# Keyman is copyright (C) SIL Global. MIT License.
|
||||
|
||||
ARG DISTRO=ubuntu
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ build_action() {
|
|||
|
||||
# shellcheck disable=SC2164
|
||||
cd "${platform}"
|
||||
export DOCKER_BUILDKIT=1
|
||||
# shellcheck disable=SC2248,SC2086
|
||||
docker build ${OPTION_NO_CACHE:-} -t "keymanapp/keyman-${platform}-ci:${build_version}" "${build_args[@]}" .
|
||||
# If the user didn't specify particular versions we will additionaly create an image
|
||||
|
|
@ -67,6 +68,7 @@ test_action() {
|
|||
":${platform}" -- ./build.sh configure,build,test:"${platform}"
|
||||
}
|
||||
|
||||
check_buildx_available
|
||||
check_for_default_values
|
||||
convert_parameters_to_args
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
# syntax=docker/dockerfile:1.4
|
||||
# Keyman is copyright (C) SIL Global. MIT License.
|
||||
#
|
||||
# ARGS used in this file:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
# syntax=docker/dockerfile:1.4
|
||||
# Keyman is copyright (C) SIL Global. MIT License.
|
||||
#
|
||||
# ARGS used in this file:
|
||||
|
|
|
|||
|
|
@ -59,3 +59,15 @@ check_for_default_values() {
|
|||
is_default_values() {
|
||||
${is_default_values}
|
||||
}
|
||||
|
||||
# Check that `docker buildx` is available
|
||||
check_buildx_available() {
|
||||
if ! docker --help | grep -q buildx; then
|
||||
if [[ "${OSTYPE:-}" == "linux-gnu" ]]; then
|
||||
builder_echo error "Docker buildx is not available. Please install Docker buildx to use this script. e.g. 'sudo apt install docker-buildx'"
|
||||
else
|
||||
builder_echo error "Docker buildx is not available. Please install Docker buildx to use this script."
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
# syntax=docker/dockerfile:1.4
|
||||
# Keyman is copyright (C) SIL Global. MIT License.
|
||||
|
||||
ARG BASE_VERSION=default
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
# syntax=docker/dockerfile:1.4
|
||||
# Keyman is copyright (C) SIL Global. MIT License.
|
||||
#
|
||||
# ARGS used in this file:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue