-
Notifications
You must be signed in to change notification settings - Fork 102
/
Dockerfile.assisted-test-infra
80 lines (66 loc) · 3.38 KB
/
Dockerfile.assisted-test-infra
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
FROM quay.io/assisted-installer-ops/base-python:3.12
# A directory in the path with write permission even for non-root users
ENV TOOLS=/tools/
ENV PATH="$TOOLS:$PATH"
RUN mkdir $TOOLS --mode g+xw
# TODO: Remove once OpenShift CI supports it out of the box (see https://access.redhat.com/articles/4859371)
RUN chmod g+w /etc/passwd && \
echo 'echo default:x:$(id -u):$(id -g):Default Application User:/alabama:/sbin/nologin\ >> /etc/passwd' > /usr/local/bin/fix_uid.sh && \
chmod g+rwx /usr/local/bin/fix_uid.sh
# tune dnf to download more packages in parallel and from the closest mirror
RUN echo "fastestmirror=1" >> /etc/dnf/dnf.conf && \
echo "max_parallel_downloads=10" >> /etc/dnf/dnf.conf
# CRB repo is required for libvirt-devel
RUN dnf -y install --enablerepo=crb \
make \
gcc \
unzip \
curl-minimal \
git \
httpd-tools \
jq \
nss_wrapper \
libvirt-client \
guestfs-tools \
libvirt-devel \
libguestfs-tools \
libxslt \
xorriso \
iptables-nft \
&& dnf clean all
# Git checks if the user that owns the files on the filesystem match the
# current user. We need to disable this check because tests in Prow are
# running with a random user.
RUN git config --system --add safe.directory '*'
RUN curl --retry 5 --connect-timeout 30 -Lo packer.zip https://releases.hashicorp.com/packer/1.9.4/packer_1.9.4_linux_386.zip && unzip packer.zip -d /usr/bin/ && mv /usr/bin/packer /usr/bin/packer.io && rm -rf packer.zip
RUN curl --retry 5 --connect-timeout 30 -Lo terraform.zip https://releases.hashicorp.com/terraform/1.6.3/terraform_1.6.3_linux_amd64.zip && unzip terraform.zip -d /usr/bin/ && rm -rf terraform.zip
RUN curl --retry 5 --connect-timeout 30 -L https://github.com/containers/podman/releases/download/v3.4.4/podman-remote-static.tar.gz -o "/tmp/podman-remote3.tar.gz" && \
tar -zxvf /tmp/podman-remote3.tar.gz && \
mv podman-remote-static /tools/podman-remote3 && \
rm -f /tmp/podman-remote3.tar.gz &&\
curl --retry 5 --connect-timeout 30 -L https://github.com/containers/podman/releases/download/v4.1.1/podman-remote-static.tar.gz -o "/tmp/podman-remote4.tar.gz" && \
tar -zxvf /tmp/podman-remote4.tar.gz && \
mv podman-remote-static /tools/podman-remote4 && \
rm -f /tmp/podman-remote4.tar.gz
COPY --from=quay.io/ocp-splat/govc:v0.29.0 /govc /usr/local/bin
WORKDIR /home/assisted-test-infra
COPY requirements.txt requirements-dev.txt ./
RUN pip3 install --upgrade pip && \
pip3 install --no-cache-dir -I -r ./requirements.txt -r ./requirements-dev.txt
RUN curl --retry 5 --connect-timeout 30 -s https://storage.googleapis.com/golang/go1.18.1.linux-amd64.tar.gz | tar -C /usr/local -xz
ENV GOPATH=/go
ENV GOCACHE=/go/.cache
ENV PATH=$PATH:/usr/local/go/bin:/go/bin
COPY . .
# init terraform in order to cache the provider
RUN source scripts/utils.sh && \
retry -- terraform -chdir=/home/assisted-test-infra/terraform_files/equinix-ci-machine init && \
retry -- terraform -chdir=/home/assisted-test-infra/terraform_files/oci-ci-machine init && \
chgrp -R 0 /home/assisted-test-infra && \
chmod -R g=u /home/assisted-test-infra
# setting pre-commit env
ENV PRE_COMMIT_HOME build
# Install the assisted-service Python client if it exists locally.
# In the CI, it will be missing during the first build in "images" in prow,
# but should be present after running "make image_build" during setup.
RUN pip3 install --no-index ./.pip/* || true