Repository navigation
Expand file tree
/
Copy pathContainerfile
More file actions
96 lines (82 loc) · 3.71 KB
/
Copy pathContainerfile
File metadata and controls
96 lines (82 loc) · 3.71 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
FROM registry.fedoraproject.org/fedora:43
LABEL name="art-tools-dev" \
description="art-tools development container image" \
maintainer="OpenShift Automated Release Tooling (ART) Team <aos-team-art@redhat.com>"
ENV \
ELLIOTT_DATA_PATH=https://github.com/openshift-eng/ocp-build-data \
DOOZER_DATA_PATH=https://github.com/openshift-eng/ocp-build-data \
PATH="/usr/local/go/bin:$PATH"
ARG OC_VERSION=latest
ARG GO_VERSION=1.24.4
ARG ACT_VERSION=v0.2.78
# User configuration
# These values can be overridden at build time
# to customize the user and group IDs
# for the development user in the container.
# This is useful for matching the host user to avoid permission issues
# when mounting volumes or sharing files between the host and container.
ARG USERNAME=dev
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Trust the Red Hat IT Root CAs and set up rcm-tools repo
RUN curl -fLo /etc/pki/ca-trust/source/anchors/IT-Root-CAs.pem https://certs.corp.redhat.com/certs/Current-IT-Root-CAs.pem \
&& update-ca-trust extract \
&& curl -o /etc/yum.repos.d/rcm-tools-fedora.repo https://download.devel.redhat.com/rel-eng/RCMTOOLS/rcm-tools-fedora.repo
RUN dnf install -y \
# runtime dependencies
krb5-workstation git tig rsync koji skopeo podman docker rpmdevtools \
python3.11 python3-certifi python-bugzilla-cli \
# nice to have tools
jq tree findutils expect \
# provides en_US.UTF-8 locale
glibc-langpack-en \
# development dependencies
gcc gcc-c++ krb5-devel \
python3.11-devel python3-pip python3-wheel python3-autopep8 \
# other tools for development and troubleshooting
bash-completion vim tmux procps-ng psmisc wget net-tools iproute socat \
# install rcm-tools
koji brewkoji rhpkg \
# add sigstore cosign tool (commented out for now) \
&& dnf clean all \
&& ln -sfn /usr/bin/python3.11 /usr/bin/python3 \
&& ln -sfn /usr/bin/python3.11 /usr/bin/python
# Set locale early for any package installs that might rely on it
ENV \
LANG="en_US.UTF-8" \
LC_ALL="en_US.UTF-8"
# Include oc client
RUN wget -O /tmp/openshift-client-linux-"$OC_VERSION".tar.gz https://mirror.openshift.com/pub/openshift-v4/clients/ocp-dev-preview/"$OC_VERSION"/openshift-client-linux.tar.gz \
&& tar -C /usr/local/bin -xzf /tmp/openshift-client-linux-"$OC_VERSION".tar.gz oc kubectl \
&& rm /tmp/openshift-client-linux-"$OC_VERSION".tar.gz
# Install golang from source
RUN wget -O /tmp/go${GO_VERSION}.linux-amd64.tar.gz https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz \
&& rm -rf /usr/local/go \
&& tar -C /usr/local -xzf /tmp/go${GO_VERSION}.linux-amd64.tar.gz \
&& rm /tmp/go${GO_VERSION}.linux-amd64.tar.gz
# install act CLI
RUN curl -sSfL -o act.tar.gz https://github.com/nektos/act/releases/download/${ACT_VERSION}/act_Linux_x86_64.tar.gz && \
tar -xzf act.tar.gz && \
mv act /usr/local/bin/act && \
chmod +x /usr/local/bin/act && \
rm act.tar.gz
# Install uv
RUN curl -LsSf https://astral.sh/uv/install.sh | UV_INSTALL_DIR=/usr/local/bin sh
ENV PATH="/usr/local/bin:$PATH"
# Create the "dev" user with necessary permissions and directories
RUN groupadd --gid "$USER_GID" "$USERNAME" \
&& useradd --uid "$USER_UID" --gid "$USER_GID" -m "$USERNAME" \
&& mkdir -p /workspaces/{art-tools,ocp-build-data,doozer-working-dir,elliott-working-dir} \
&& chown -R "$USER_UID:$USER_GID" /home/"$USERNAME" /workspaces \
&& chmod 0755 /home/"$USERNAME" \
&& echo "$USERNAME ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/"$USERNAME" \
&& chmod 0440 /etc/sudoers.d/"$USERNAME"
# Configure Kerberos
COPY artcommon/configs/krb5-redhat.conf /etc/krb5.conf.d/
# Set workdir
WORKDIR /workspaces/art-tools
COPY --chown="$USER_UID:$USER_GID" . .
USER "$USER_UID"
ENV VIRTUAL_ENV=/workspaces/art-tools/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN uv sync