-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile.rhel
More file actions
91 lines (78 loc) · 3.91 KB
/
Dockerfile.rhel
File metadata and controls
91 lines (78 loc) · 3.91 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
ARG ALMA_VERSION=10
FROM almalinux:${ALMA_VERSION}
ARG ALMA_VERSION=10
ARG TARGETARCH
ARG RPM_ARCH
ARG UID=1000
ARG GID=1000
SHELL ["/bin/bash", "-c"]
RUN if [ -z "${RPM_ARCH}" ]; then \
case "${TARGETARCH:-$(uname -m)}" in \
arm64|aarch64) echo aarch64 > /tmp/rpm_arch ;; \
*) echo x86_64 > /tmp/rpm_arch ;; \
esac; \
else echo "${RPM_ARCH}" > /tmp/rpm_arch; fi
ENV PATH=/opt/rh/gcc-toolset-15/root/usr/bin:/usr/lib/gcc-toolset-15/root/usr/bin:${PATH}
ENV LD_LIBRARY_PATH=/opt/rh/gcc-toolset-15/root/usr/lib64:/usr/lib/gcc-toolset-15/root/usr/lib64:/opt/rh/gcc-toolset-15/root/usr/lib:/usr/lib/gcc-toolset-15/root/usr/lib
ENV PKG_CONFIG_PATH=/opt/rh/gcc-toolset-15/root/usr/lib64/pkgconfig:/usr/lib/gcc-toolset-15/root/usr/lib64/pkgconfig
ENV MANPATH=/opt/rh/gcc-toolset-15/root/usr/share/man:/usr/lib/gcc-toolset-15/root/usr/share/man
RUN dnf -y install epel-release dnf-plugins-core && \
if [[ "${ALMA_VERSION}" == "8" ]]; then \
dnf config-manager --set-enabled powertools; \
else \
dnf config-manager --set-enabled crb; \
fi && \
dnf -y --allowerasing install \
perl make rpm-build rpm-sign rpmdevtools \
openssh rsync createrepo_c gpg \
git jq gzip which sudo xz tar zstd curl \
python3 python3-requests \
bison flex autoconf automake gettext-devel libtool pkgconfig \
gcc-toolset-15 llvm nasm && \
mkdir -p /usr/lib/bfd-plugins && \
PLUGIN=$(find /usr/lib /usr/lib64 -name LLVMgold.so 2>/dev/null | head -1) && \
[ -n "$PLUGIN" ] && ln -sf "$PLUGIN" /usr/lib/bfd-plugins/LLVMgold.so
RUN if [[ "${ALMA_VERSION}" == "8" || "${ALMA_VERSION}" == "9" ]]; then \
dnf -y install '@ruby:3.3' rubygems ruby-devel; \
else \
dnf -y install ruby rubygems ruby-devel; \
fi && \
gem install --no-document fpm
RUN if [[ "${ALMA_VERSION}" == "9" || "${ALMA_VERSION}" == "10" ]]; then \
dnf -y install re2c; \
else \
dnf -y install python39 && \
curl -L https://github.com/skvadrik/re2c/releases/download/4.3/re2c-4.3.tar.xz | tar xJ && \
cd re2c-4.3 && ./configure && make -j"$(nproc)" && make install && cd .. && rm -rf re2c-4.3; \
fi
RUN if [[ "${ALMA_VERSION}" == "8" || "${ALMA_VERSION}" == "9" ]]; then \
echo 'source /opt/rh/gcc-toolset-15/enable' > /etc/profile.d/gcc-toolset.sh; \
else \
echo 'source /usr/lib/gcc-toolset/15-env.source' > /etc/profile.d/gcc-toolset.sh; \
fi && \
chmod +x /etc/profile.d/gcc-toolset.sh
RUN curl -o cmake.tar.gz -fsSL "https://github.com/Kitware/CMake/releases/download/v3.31.4/cmake-3.31.4-linux-$(uname -m).tar.gz" && \
tar -xzf cmake.tar.gz -C /usr/local --strip-components=1 && \
rm cmake.tar.gz
RUN RPM_ARCH=$(cat /tmp/rpm_arch) && \
curl -L "https://files.henderkes.com/${RPM_ARCH}-linux/php" -o /usr/local/bin/php && \
chmod +x /usr/local/bin/php && \
curl -sS https://raw.githubusercontent.com/composer/getcomposer.org/f3108f64b4e1c1ce6eb462b159956461592b3e3e/web/installer | php -- --quiet && \
mv composer.phar /usr/bin/composer
RUN U=$(id -un 1000 2>/dev/null || echo "") && \
if [ -z "$U" ]; then \
groupadd -g 1000 builder && useradd -m -u 1000 -g 1000 -s /bin/bash builder && U=builder; \
fi && \
echo "$U ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/builder
# Pre-install SPC's go-xcaddy and zig packages so workflows don't redownload them.
ENV PKG_ROOT_PATH=/opt/spc-pkgroot
COPY composer.json composer.lock /tmp/spc-bootstrap/
RUN cd /tmp/spc-bootstrap && \
mkdir -p src && \
composer install --no-interaction --prefer-dist --no-progress --no-scripts && \
php vendor/bin/spc install-pkg go-xcaddy && \
php vendor/bin/spc install-pkg zig && \
SPC_TARGET=native-native-musl php vendor/bin/spc doctor --auto-fix --debug && \
rm -rf /tmp/spc-bootstrap /root/.composer /root/.cache && \
chown -R ${UID}:${GID} "$PKG_ROOT_PATH"
WORKDIR /build