From 93210547bd1bfbbb1ffd56801bb81af46af350a5 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Tue, 10 Apr 2018 18:47:56 +0100 Subject: Update build instructions and Dockerfile to download submodules --- util/docker_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/docker_build.sh') diff --git a/util/docker_build.sh b/util/docker_build.sh index e7aeac8f3e..35839ac41e 100755 --- a/util/docker_build.sh +++ b/util/docker_build.sh @@ -47,4 +47,4 @@ dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows # Run container and build firmware docker run --rm -it $usb_args -v "$dir":/qmk_firmware qmkfm/qmk_firmware \ - make "$keyboard${keymap:+:$keymap}${target:+:$target}" + /bin/bash -c "make git-submodule; make \"$keyboard${keymap:+:$keymap}${target:+:$target}\"" -- cgit v1.2.3 From 4882f7f16d3d5ef850790c935cf02112a615fd3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Wed, 10 Apr 2019 23:15:51 +0200 Subject: Revert "Update build instructions and docker file to download submodules" (#5533) * Revert "Update build instructions and Dockerfile to download submodules" This reverts commit 93210547bd1bfbbb1ffd56801bb81af46af350a5. * Update build tools docs based on feedback * Fix bad link in build tools docs --- util/docker_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/docker_build.sh') diff --git a/util/docker_build.sh b/util/docker_build.sh index 35839ac41e..e7aeac8f3e 100755 --- a/util/docker_build.sh +++ b/util/docker_build.sh @@ -47,4 +47,4 @@ dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows # Run container and build firmware docker run --rm -it $usb_args -v "$dir":/qmk_firmware qmkfm/qmk_firmware \ - /bin/bash -c "make git-submodule; make \"$keyboard${keymap:+:$keymap}${target:+:$target}\"" + make "$keyboard${keymap:+:$keymap}${target:+:$target}" -- cgit v1.2.3 From e73587cfd08b2bd73987e7f762194079875df93a Mon Sep 17 00:00:00 2001 From: Robin Hallabro-Kokko <44033026+hallabro@users.noreply.github.com> Date: Sat, 4 May 2019 00:41:39 +0000 Subject: docker_build.sh: Docker requires access to hosts devices (#5063) * docker_build.sh: Docker requires access to hosts devices This also runs the container interactively which allows the user to interupt the build with Ctrl-C. * docker_build.sh: Mount /dev via $usb_args instead --- util/docker_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/docker_build.sh') diff --git a/util/docker_build.sh b/util/docker_build.sh index e7aeac8f3e..c573ebcae2 100755 --- a/util/docker_build.sh +++ b/util/docker_build.sh @@ -35,7 +35,7 @@ else fi if [ -n "$target" ]; then if [ "$(uname)" = "Linux" ] || docker-machine active >/dev/null 2>&1; then - usb_args="--privileged -v /dev/bus/usb:/dev/bus/usb" + usb_args="--privileged -v /dev:/dev" else echo "Error: target requires docker-machine to work on your platform" >&2 echo "See http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos" >&2 -- cgit v1.2.3 From 0a03f7cff7b6892ca93333fa5061c1ca454de0cb Mon Sep 17 00:00:00 2001 From: zvecr Date: Wed, 5 Jun 2019 01:17:01 +0100 Subject: Update docker util script and travis to use new base container --- util/docker_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/docker_build.sh') diff --git a/util/docker_build.sh b/util/docker_build.sh index c573ebcae2..6feeb1f5d2 100755 --- a/util/docker_build.sh +++ b/util/docker_build.sh @@ -46,5 +46,5 @@ fi dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows # Run container and build firmware -docker run --rm -it $usb_args -v "$dir":/qmk_firmware qmkfm/qmk_firmware \ +docker run --rm -it $usb_args -w /qmk_firmware/ -v "$dir":/qmk_firmware qmkfm/base_container \ make "$keyboard${keymap:+:$keymap}${target:+:$target}" -- cgit v1.2.3 From 9813a6f950b46277eb29c54105809767cc0daa65 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Thu, 15 Aug 2019 22:03:26 +0100 Subject: Add an alternative method for keyboard discovery to speed up build (#6073) * Add an alternative method for keyboard discovery to speed up build * Chain MAKEFLAGS for docker_build.sh * Slight improvement to number of items sent to sort * Remove debug line * Fix line escape --- util/docker_build.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'util/docker_build.sh') diff --git a/util/docker_build.sh b/util/docker_build.sh index 6feeb1f5d2..f36d5bcde5 100755 --- a/util/docker_build.sh +++ b/util/docker_build.sh @@ -46,5 +46,11 @@ fi dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows # Run container and build firmware -docker run --rm -it $usb_args -w /qmk_firmware/ -v "$dir":/qmk_firmware qmkfm/base_container \ +docker run --rm -it $usb_args \ + -w /qmk_firmware/ \ + -v "$dir":/qmk_firmware \ + -e ALT_GET_KEYBOARDS=true \ + -e SKIP_GIT="$SKIP_GIT" \ + -e MAKEFLAGS="$MAKEFLAGS" \ + qmkfm/base_container \ make "$keyboard${keymap:+:$keymap}${target:+:$target}" -- cgit v1.2.3 From 4d339b7b5d1ecc2320080798d7e07e2d43675578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Sat, 7 Sep 2019 10:17:54 +0200 Subject: Update docker_build.sh: indentation fix, error echo function (#6659) * Replace spaces with tab in docker_build.sh * Use errcho instead of echo >&2 --- util/docker_build.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'util/docker_build.sh') diff --git a/util/docker_build.sh b/util/docker_build.sh index f36d5bcde5..99d59d1696 100755 --- a/util/docker_build.sh +++ b/util/docker_build.sh @@ -1,6 +1,10 @@ #!/bin/sh # NOTE: This script uses tabs for indentation +errcho() { + echo "$@" >&2 +} + USAGE="Usage: $0 [keyboard[:keymap[:target]]]" # Check preconditions @@ -11,11 +15,11 @@ for arg; do fi done if [ $# -gt 1 ]; then - echo "$USAGE" >&2 + errcho "$USAGE" exit 1 elif ! command -v docker >/dev/null 2>&1; then - echo "Error: docker not found" >&2 - echo "See https://docs.docker.com/install/#supported-platforms for installation instructions" >&2 + errcho "Error: docker not found" + errcho "See https://docs.docker.com/install/#supported-platforms for installation instructions" exit 2 fi @@ -29,7 +33,7 @@ else $1 EOF if [ -n "$x" ]; then - echo "$USAGE" >&2 + errcho "$USAGE" exit 1 fi fi @@ -37,9 +41,9 @@ if [ -n "$target" ]; then if [ "$(uname)" = "Linux" ] || docker-machine active >/dev/null 2>&1; then usb_args="--privileged -v /dev:/dev" else - echo "Error: target requires docker-machine to work on your platform" >&2 - echo "See http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos" >&2 - echo "Consider flashing with QMK Toolbox (https://github.com/qmk/qmk_toolbox) instead" >&2 + errcho "Error: target requires docker-machine to work on your platform" + errcho "See http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos" + errcho "Consider flashing with QMK Toolbox (https://github.com/qmk/qmk_toolbox) instead" exit 3 fi fi @@ -47,7 +51,7 @@ dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows # Run container and build firmware docker run --rm -it $usb_args \ - -w /qmk_firmware/ \ + -w /qmk_firmware \ -v "$dir":/qmk_firmware \ -e ALT_GET_KEYBOARDS=true \ -e SKIP_GIT="$SKIP_GIT" \ -- cgit v1.2.3 From 385454e6026e25b48bd15f76c237f88955f07088 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Sat, 30 Nov 2019 00:01:22 +1100 Subject: Fix output file permissions when using docker build. (#7378) --- util/docker_build.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'util/docker_build.sh') diff --git a/util/docker_build.sh b/util/docker_build.sh index 99d59d1696..d8c4c759a3 100755 --- a/util/docker_build.sh +++ b/util/docker_build.sh @@ -51,6 +51,7 @@ dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows # Run container and build firmware docker run --rm -it $usb_args \ + --user $(id -u):$(id -g) \ -w /qmk_firmware \ -v "$dir":/qmk_firmware \ -e ALT_GET_KEYBOARDS=true \ -- cgit v1.2.3 From 5a02cc00a43cbeb9cc6ad94811acfb861d8f3929 Mon Sep 17 00:00:00 2001 From: shela Date: Fri, 10 Jan 2020 09:44:16 +0900 Subject: Fix docker script and document (#7786) Fixed error when keyboard parameter is omitted in interactive mode. --- util/docker_build.sh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'util/docker_build.sh') diff --git a/util/docker_build.sh b/util/docker_build.sh index d8c4c759a3..bf13f50975 100755 --- a/util/docker_build.sh +++ b/util/docker_build.sh @@ -37,6 +37,9 @@ else exit 1 fi fi +if [ -z "$keyboard" ]; then + keyboard=all +fi if [ -n "$target" ]; then if [ "$(uname)" = "Linux" ] || docker-machine active >/dev/null 2>&1; then usb_args="--privileged -v /dev:/dev" -- cgit v1.2.3 From e4d3ff2374142fe6431b68874f6604a471732fae Mon Sep 17 00:00:00 2001 From: Max Audron Date: Sun, 28 Feb 2021 05:59:42 +0100 Subject: Add support for using podman to util/docker_build.sh (#10819) * add podman support to docker_build.sh script * break out runtime into the RUNTIME variable * allows RUNTIME to be set by the user * decides on docker or podman if docker isn't avaible * rewrote check for docker-machine to account only for docker runtime * put --user arg into a variable only to be used with docker this is not needed with podman as podman maps the containers root id to the users id. * add podman to getting_started_docker documentation --- util/docker_build.sh | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'util/docker_build.sh') diff --git a/util/docker_build.sh b/util/docker_build.sh index bf13f50975..2b109be76d 100755 --- a/util/docker_build.sh +++ b/util/docker_build.sh @@ -17,12 +17,27 @@ done if [ $# -gt 1 ]; then errcho "$USAGE" exit 1 -elif ! command -v docker >/dev/null 2>&1; then - errcho "Error: docker not found" - errcho "See https://docs.docker.com/install/#supported-platforms for installation instructions" - exit 2 fi +# Allow $RUNTIME to be overriden by the user as an environment variable +# Else check if either docker or podman exit and set them as runtime +# if none are found error out +if [ -z "$RUNTIME" ]; then + if command -v docker >/dev/null 2>&1; then + RUNTIME="docker" + elif command -v podman >/dev/null 2>&1; then + RUNTIME="podman" + else + errcho "Error: no compatible container runtime found." + errcho "Either podman or docker are required." + errcho "See https://podman.io/getting-started/installation" + errcho "or https://docs.docker.com/install/#supported-platforms" + errcho "for installation instructions." + exit 2 + fi +fi + + # Determine arguments if [ $# -eq 0 ]; then printf "keyboard=" && read -r keyboard @@ -41,20 +56,26 @@ if [ -z "$keyboard" ]; then keyboard=all fi if [ -n "$target" ]; then - if [ "$(uname)" = "Linux" ] || docker-machine active >/dev/null 2>&1; then - usb_args="--privileged -v /dev:/dev" - else + # IF we are using docker on non Linux and docker-machine isn't working print an error + # ELSE set usb_args + if [ ! "$(uname)" = "Linux" ] && [ "$RUNTIME" = "docker" ] && ! docker-machine active >/dev/null 2>&1; then errcho "Error: target requires docker-machine to work on your platform" errcho "See http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos" errcho "Consider flashing with QMK Toolbox (https://github.com/qmk/qmk_toolbox) instead" exit 3 + else + usb_args="--privileged -v /dev:/dev" fi fi dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows +if [ "$RUNTIME" = "docker" ]; then + uid_arg="--user $(id -u):$(id -g)" +fi + # Run container and build firmware -docker run --rm -it $usb_args \ - --user $(id -u):$(id -g) \ +"$RUNTIME" run --rm -it $usb_args \ + $uid_arg \ -w /qmk_firmware \ -v "$dir":/qmk_firmware \ -e ALT_GET_KEYBOARDS=true \ -- cgit v1.2.3