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>
This commit is contained in:
parent
e352ea1ccd
commit
d3a89cdb74
|
@ -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)
|
||||
|
|
|
@ -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 && \
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue