-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
40 lines (28 loc) · 1.34 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
ARG image="quay.io/centos/centos:stream9"
FROM ${image} as base
ARG channel="stable"
ARG location
RUN [ -z "${channel}" ] && echo "ARG channel is required" && exit 1 || true
RUN yum -y install jq xz
RUN ARCH=$(uname -m) ; echo $ARCH \
; curl https://builds.coreos.fedoraproject.org/streams/${channel}.json -o stable.json && \
cat stable.json | jq -r --arg arch "$ARCH" '.architectures[$arch].artifacts.qemu.release'
FROM base AS executor-img
RUN ARCH=$(uname -m) ; \
echo "Downloading" $(cat stable.json | jq -r --arg arch "$ARCH" '.architectures[$arch].artifacts.qemu.formats."qcow2.xz".disk.location') && \
curl -s -o coreos_production_qemu_image.qcow2.xz $(cat stable.json | jq -r --arg arch "$ARCH" '.architectures[$arch].artifacts.qemu.formats."qcow2.xz".disk.location') && \
unxz coreos_production_qemu_image.qcow2.xz
FROM base AS final
ARG channel=stable
RUN mkdir -p /userdata
WORKDIR /userdata
RUN yum -y update && \
yum -y remove jq && \
yum -y install openssh-clients qemu-kvm && \
yum -y clean all
COPY --from=executor-img /coreos_production_qemu_image.qcow2 /userdata/coreos_production_qemu_image.qcow2
COPY start.sh /userdata/start.sh
RUN chgrp -R 0 /userdata && \
chmod -R g=u /userdata
LABEL com.coreos.channel ${channel}
ENTRYPOINT ["/bin/bash", "/userdata/start.sh"]