-
Notifications
You must be signed in to change notification settings - Fork 30
/
Dockerfile.openshift-appliance
59 lines (47 loc) · 2.15 KB
/
Dockerfile.openshift-appliance
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Build appliance
FROM registry.access.redhat.com/ubi9/go-toolset:9.5 as builder
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
COPY . .
RUN cd cmd && CGO_ENABLED=1 GOFLAGS="" GO111MODULE=on go build -o /tmp/openshift-appliance
# Create final image
FROM registry.access.redhat.com/ubi9/ubi:latest
# Create/Mount assets
ARG ASSETS_DIR=/assets
RUN mkdir $ASSETS_DIR && chmod 775 $ASSETS_DIR
VOLUME $ASSETS_DIR
ENV ASSETS_DIR=$ASSETS_DIR
# Install skopeo and podman
RUN dnf -y install skopeo podman && dnf clean all
# Add repos
RUN dnf install -y yum-utils
RUN yum-config-manager --disable \*
RUN yum-config-manager --add-repo http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/
RUN yum-config-manager --add-repo http://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/
RUN rpm --import https://centos.org/keys/RPM-GPG-KEY-CentOS-Official
# Install and config libguestfs
RUN dnf repolist
RUN dnf -y --allowerasing install guestfs-tools genisoimage coreos-installer syslinux && dnf clean all
ENV LIBGUESTFS_BACKEND=direct
# Download oc-mirror
RUN curl -sL https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/oc-mirror.tar.gz \
| tar xvzf - -C /usr/local/bin && \
chmod +x /usr/local/bin/oc-mirror
# Download oc
RUN curl -sL https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz \
| tar xvzf - -C /usr/local/bin && \
chmod +x /usr/local/bin/oc
# Copy openshift-appliance binary
COPY --from=builder /tmp/openshift-appliance /openshift-appliance
# Copy
RUN mkdir -p data
COPY /data data
ENTRYPOINT ["/openshift-appliance", "--dir", "assets"]
LABEL summary="OpenShift-based Appliance Builder" \
name="OpenShift-based Appliance Builder" \
description="A utility for building a disk image that orchestrates OpenShift installation using the Agent-based installer." \
io.k8s.description="A utility for building a disk image that orchestrates OpenShift installation using the Agent-based installer." \
io.k8s.display-name="OpenShift-based Appliance Builder" \
io.openshift.tags="openshift,appliance,installer,agent" \
com.redhat.component="openshift-appliance"