File tree Expand file tree Collapse file tree 2 files changed +25
-16
lines changed Expand file tree Collapse file tree 2 files changed +25
-16
lines changed Original file line number Diff line number Diff line change 1- FROM centos:8 as executor-img
1+ FROM centos:8 as base
2+ ARG channel="stable"
23ARG location
3- ARG channel
4- ARG version
54
6- RUN [ -z "${location}" ] || [ -z "${ channel}" ] || [ -z "${version}" ] && echo "ARG location, channel, version are required" && exit 1 || true
5+ RUN [ -z "${channel}" ] && echo "ARG channel is required" && exit 1 || true
76
8- RUN echo "Downloading" ${location}
9- RUN curl -s -o coreos_production_qemu_image.qcow2.xz ${location} && unxz coreos_production_qemu_image.qcow2.xz
7+ RUN yum -y install jq
8+ RUN curl https://builds.coreos.fedoraproject.org/streams/${channel}.json -o stable.json && \
9+ cat stable.json | jq '.architectures.x86_64.artifacts.qemu.release' | tr -d '"'
1010
1111
12- FROM centos:8
13- ARG location
14- ARG channel
15- ARG version
12+ FROM base AS executor-img
13+
14+ RUN if [[ -z "$arg" ]] ; then \
15+ echo "Downloading" $(cat stable.json | jq '.architectures.x86_64.artifacts.qemu.formats."qcow2.xz".disk.location' | tr -d '"' ) && \
16+ curl -s -o coreos_production_qemu_image.qcow2.xz $(cat stable.json | jq '.architectures.x86_64.artifacts.qemu.formats."qcow2.xz".disk.location' | tr -d '"' ) && unxz coreos_production_qemu_image.qcow2.xz ; \
17+ else \
18+ echo "Downloading" ${location} && \
19+ curl -s -o coreos_production_qemu_image.qcow2.xz ${location} && unxz coreos_production_qemu_image.qcow2.xz \
20+ ; fi
21+
22+
23+ FROM base AS final
24+ ARG channel=stable
1625
1726RUN mkdir -p /userdata
1827WORKDIR /userdata
1928
2029RUN yum -y update && \
21- yum -y install openssh-clients qemu-kvm && \
22- yum -y clean all
30+ yum -y remove jq && \
31+ yum -y install openssh-clients qemu-kvm && \
32+ yum -y clean all
2333
2434COPY --from=executor-img /coreos_production_qemu_image.qcow2 /userdata/coreos_production_qemu_image.qcow2
2535COPY start.sh /userdata/start.sh
@@ -28,6 +38,5 @@ RUN chgrp -R 0 /userdata && \
2838 chmod -R g=u /userdata
2939
3040LABEL com.coreos.channel ${channel}
31- LABEL com.coreos.version ${version}
3241
3342ENTRYPOINT ["/bin/bash" , "/userdata/start.sh" ]
Original file line number Diff line number Diff line change @@ -7,11 +7,11 @@ CLOUD_IMAGE=${CLOUD_IMAGE:-""}
77
88if [ -z " $CLOUD_IMAGE " ]; then
99 CHANNEL=${CHANNEL:- " stable" }
10- CHANNEL_MANIFEST_JSON=` curl https://builds.coreos.fedoraproject.org/streams/stable .json`
10+ CHANNEL_MANIFEST_JSON=` curl https://builds.coreos.fedoraproject.org/streams/${CHANNEL} .json`
1111 LOCATION=` echo $CHANNEL_MANIFEST_JSON | jq ' .architectures.x86_64.artifacts.qemu.formats."qcow2.xz".disk.location' | tr -d ' "' `
1212 VERSION=` echo $CHANNEL_MANIFEST_JSON | jq ' .architectures.x86_64.artifacts.qemu.release' | tr -d ' "' `
1313
14- time docker build --build-arg=channel=$CHANNEL --build-arg version= $VERSION --build-arg location= $LOCATION -t $IMAGE :$TAG .
14+ time docker build --build-arg=channel=$CHANNEL --build-arg --build-arg -t $IMAGE :$TAG .
1515else
16- time docker build --build-arg=channel=$CHANNEL --build-arg version= $VERSION --build-arg location=$CLOUD_IMAGE -t $IMAGE :$TAG .
16+ time docker build --build-arg=channel=$CHANNEL --build-arg --build-arg location=$CLOUD_IMAGE -t $IMAGE :$TAG .
1717fi
You can’t perform that action at this time.
0 commit comments