diff options
author | Tim Crawford <tcrawford@system76.com> | 2023-08-29 08:29:40 -0600 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-09-07 13:36:20 +0000 |
commit | d3a89cdb749aad5bc378552eee3167003219b62d (patch) | |
tree | 8c1ddf6983ecca6143842d36fb3b1d92e8d9a243 /util/docker | |
parent | e352ea1ccd1292731ad80f3fa3152d39e15511ef (diff) |
util/docker: Replace use of sed with build args
Change-Id: I9ab101e06ed670dfe6802f9bd0df128d056446db
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/77540
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/docker')
-rw-r--r-- | util/docker/Makefile | 18 | ||||
-rw-r--r-- | util/docker/coreboot-jenkins-test/Dockerfile | 4 | ||||
-rw-r--r-- | util/docker/coreboot-sdk/Dockerfile | 33 |
3 files changed, 28 insertions, 27 deletions
diff --git a/util/docker/Makefile b/util/docker/Makefile index 13fa80d9b7..ca274b7143 100644 --- a/util/docker/Makefile +++ b/util/docker/Makefile @@ -42,17 +42,19 @@ test-docker-login: test-docker coreboot-sdk: test-docker @echo "Building coreboot SDK $(crossgcc_version) from commit $(DOCKER_COMMIT)" - cat coreboot-sdk/Dockerfile | \ - sed "s/{{DOCKER_COMMIT}}/$(DOCKER_COMMIT)/g" | \ - sed "s/{{SDK_VERSION}}/$(COREBOOT_IMAGE_TAG)/g" | \ - sed "s/{{CROSSGCC_PARAM}}/$(COREBOOT_CROSSGCC_PARAM)/g" | \ - $(DOCKER) build -t coreboot/coreboot-sdk:$(COREBOOT_IMAGE_TAG) - + $(DOCKER) build \ + --tag coreboot/coreboot-sdk:$(COREBOOT_IMAGE_TAG) \ + --build-arg=SDK_VERSION="$(SDK_VERSION)" \ + --build-arg=DOCKER_COMMIT="$(DOCKER_COMMIT)" \ + --build-arg=CROSSGCC_PARAM="$(COREBOOT_CROSSGCC_PARAM)" \ + coreboot-sdk coreboot-jenkins-test: test-docker @echo "Testing coreboot SDK and jenkins node version $(crossgcc_version), built from commit $(DOCKER_COMMIT)" - cat coreboot-jenkins-test/Dockerfile | \ - sed "s/{{SDK_VERSION}}/$(COREBOOT_IMAGE_TAG)/g" | \ - $(DOCKER) build -t coreboot/coreboot-jenkins-test:$(COREBOOT_IMAGE_TAG) - + $(DOCKER) build \ + --tag coreboot/coreboot-jenkins-test:$(COREBOOT_IMAGE_TAG) \ + --build-arg=SDK_VERSION="$(COREBOOT_IMAGE_TAG)" \ + coreboot-jenkins-test upload-coreboot-sdk: test-docker-login $(DOCKER) push coreboot/coreboot-sdk:$(COREBOOT_IMAGE_TAG) diff --git a/util/docker/coreboot-jenkins-test/Dockerfile b/util/docker/coreboot-jenkins-test/Dockerfile index 030c4d2bbc..d353976381 100644 --- a/util/docker/coreboot-jenkins-test/Dockerfile +++ b/util/docker/coreboot-jenkins-test/Dockerfile @@ -1,4 +1,6 @@ -FROM coreboot/coreboot-jenkins-node:{{SDK_VERSION}} +ARG SDK_VERSION + +FROM coreboot/coreboot-jenkins-node:${SDK_VERSION} # Test the built image RUN mkdir -p /tmp/work && \ diff --git a/util/docker/coreboot-sdk/Dockerfile b/util/docker/coreboot-sdk/Dockerfile index eb725c9cbc..91543e9467 100644 --- a/util/docker/coreboot-sdk/Dockerfile +++ b/util/docker/coreboot-sdk/Dockerfile @@ -1,19 +1,16 @@ -# This dockerfile is not meant to be used directly by docker. The -# {{}} variables are replaced with values by the makefile. Please generate -# the docker image for this file by running: +# Generate the docker image for this file by running: # # make coreboot-sdk -# -# Variables can be updated on the make command line or left blank to use -# the default values set by the makefile. -# -# SDK_VERSION is used to name the version of the coreboot sdk to use. -# Typically, this corresponds to the toolchain version. This -# is used to identify this docker image. -# DOCKER_COMMIT is the coreboot Commit-ID to build the toolchain from. FROM debian:sid AS coreboot-sdk +# The coreboot Commit-ID to build the toolchain from. +ARG DOCKER_COMMIT +# The version of the coreboot sdk to use. Typically, this corresponds to the +# toolchain version. This is used to identify this docker image. +ARG SDK_VERSION +ARG CROSSGCC_PARAM + RUN \ useradd -p locked -m coreboot && \ apt-get -qq update && \ @@ -93,12 +90,12 @@ RUN \ cd /tmp && \ git clone https://review.coreboot.org/coreboot && \ cd coreboot && \ - git checkout {{DOCKER_COMMIT}}; \ - if echo {{CROSSGCC_PARAM}} | grep -q ^all; then \ + git checkout ${DOCKER_COMMIT}; \ + if echo ${CROSSGCC_PARAM} | grep -q ^all; then \ make -C /tmp/coreboot/util/crossgcc/ build_clang \ BUILD_LANGUAGES=c,ada CPUS=$(nproc) DEST=/opt/xgcc; \ fi; \ - make -C /tmp/coreboot/util/crossgcc/ {{CROSSGCC_PARAM}} \ + make -C /tmp/coreboot/util/crossgcc/ ${CROSSGCC_PARAM} \ BUILD_LANGUAGES=c,ada CPUS=$(nproc) DEST=/opt/xgcc && \ rm -rf /tmp/coreboot @@ -107,12 +104,12 @@ RUN mkdir /home/coreboot/.ccache && \ mkdir /home/coreboot/cb_build && \ chown coreboot:coreboot /home/coreboot/cb_build && \ echo "export PATH=$PATH:/opt/xgcc/bin" >> /home/coreboot/.bashrc && \ - echo "export SDK_VERSION={{SDK_VERSION}}" >> /home/coreboot/.bashrc && \ - echo "export SDK_COMMIT={{DOCKER_COMMIT}}" >> /home/coreboot/.bashrc + echo "export SDK_VERSION=${SDK_VERSION}" >> /home/coreboot/.bashrc && \ + echo "export SDK_COMMIT=${DOCKER_COMMIT}" >> /home/coreboot/.bashrc ENV PATH $PATH:/opt/xgcc/bin -ENV SDK_VERSION={{SDK_VERSION}} -ENV SDK_COMMIT={{DOCKER_COMMIT}} +ENV SDK_VERSION=${SDK_VERSION} +ENV SDK_COMMIT=${DOCKER_COMMIT} USER coreboot FROM coreboot-sdk |