Skip to content

Commit ba8ed1e

Browse files
committed
Fix multi-arch builds.
1 parent 30b4f9c commit ba8ed1e

12 files changed

Lines changed: 89 additions & 32 deletions

File tree

base/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@ ARG TARGETARCH
66

77
FROM stage-${TARGETARCH} as final
88

9-
ARG TARGETARCH
10-
119
COPY . /build
1210
RUN /build/install.sh && rm -rf /build

base/install.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ log_info() {
77
printf "\n\e[0;35m $1\e[0m\n\n"
88
}
99

10-
TARGETARCH=${TARGETARCH:-amd64}
10+
ARCHTYPE=`uname -m`
1111
GOSU_VERSION=${GOSU_VERSION:-1.12}
1212

13+
log_info "HPCTS Base image for $ARCHTYPE"
14+
1315
source /build/base.config
1416

1517
#------------------------
@@ -136,7 +138,11 @@ chmod 0440 /etc/sudoers.d/90-hpcadmin
136138
# Install gosu
137139
#------------------------
138140
log_info "Installing gosu.."
139-
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$TARGETARCH"
141+
if [[ "${ARCHTYPE}" = "x86_64" ]]; then
142+
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64"
143+
elif [[ "${ARCHTYPE}" = "aarch64" ]]; then
144+
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-arm64"
145+
fi
140146
chmod +x /usr/local/bin/gosu
141147
gosu nobody true
142148

coldfront/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ ARG TARGETARCH
88

99
FROM stage-${TARGETARCH} as final
1010

11-
ARG TARGETARCH
12-
1311
COPY . /build
1412
RUN /build/install.sh && rm -rf /build
1513
COPY --chown=coldfront:coldfront local_settings.py /etc/coldfront/local_settings.py

coldfront/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ log_info() {
77
printf "\n\e[0;35m $1\e[0m\n\n"
88
}
99

10-
TARGETARCH=${TARGETARCH:-amd64}
10+
ARCHTYPE=`uname -m`
1111

1212
log_info "Installing required packages for coldfront.."
1313
dnf install -y \

ldap/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@ ARG TARGETARCH
66

77
FROM stage-${TARGETARCH} as final
88

9-
ARG TARGETARCH
10-
119
COPY . /build
1210
RUN /build/install.sh && rm -rf /build

ldap/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ log_info() {
77
printf "\n\e[0;35m $1\e[0m\n\n"
88
}
99

10-
TARGETARCH=${TARGETARCH:-amd64}
10+
ARCHTYPE=`uname -m`
1111

1212
source /build/base.config
1313

ondemand/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ ARG TARGETARCH
88

99
FROM stage-${TARGETARCH} as final
1010

11-
ARG TARGETARCH
12-
1311
COPY . /build
1412
RUN /build/install.sh && rm -rf /build
1513
COPY cluster-config.yml /etc/ood/config/clusters.d/hpc.yml

ondemand/install.sh

Lines changed: 73 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,74 @@ log_info() {
77
printf "\n\e[0;35m $1\e[0m\n\n"
88
}
99

10-
TARGETARCH=${TARGETARCH:-amd64}
10+
ARCHTYPE=`uname -m`
11+
DEX_VERSION=${DEX_VERSION:-2.31.1}
12+
DEX_PATCH_VERSION=${DEX_PATCH_VERSION:-703e26bc109e86d00be22ef1803bdb96b2dc09e2}
1113

12-
log_info "Installing required packages for Ondemand.."
14+
log_info "Installing required packages for Ondemand ${ARCHTYPE}.."
1315

14-
dnf install -y \
15-
netcat \
16-
ondemand \
17-
ondemand-dex
16+
if [[ "${ARCHTYPE}" = "x86_64" ]]; then
17+
dnf install -y https://yum.osc.edu/ondemand/2.0/ondemand-release-web-2.0-1.noarch.rpm
18+
dnf install -y \
19+
netcat \
20+
ondemand \
21+
ondemand-dex
22+
elif [[ "${ARCHTYPE}" = "aarch64" ]]; then
23+
# TODO: flesh out arm64 builds?
24+
dnf install -y golang-bin
25+
log_info "Install dex ${DEX_VERSION}..."
26+
wget -O /tmp/dex-${DEX_VERSION}.tar.gz https://github.com/dexidp/dex/archive/v${DEX_VERSION}.tar.gz
27+
wget -O /tmp/dex-ood.patch https://github.com/OSC/dex/commit/${DEX_PATCH_VERSION}.patch
28+
pushd /tmp
29+
tar xvf dex-${DEX_VERSION}.tar.gz
30+
pushd dex-${DEX_VERSION}
31+
make build
32+
mv bin/dex bin/dex-orig
33+
patch -p1 < ../dex-ood.patch
34+
make build
35+
mv bin/dex /usr/sbin/ondemand-dex-session
36+
mv bin/dex-orig /usr/sbin/ondemand-dex
37+
popd
38+
rm -rf /tmp/dex*
39+
mkdir -p /usr/share/ondemand-dex/
40+
git clone https://github.com/OSC/ondemand-dex.git
41+
pushd ondemand-dex
42+
mv web /usr/share/ondemand-dex/
43+
popd
44+
rm -Rf ondemand-dex
45+
groupadd -r ondemand-dex
46+
useradd -r -d /var/lib/ondemand-dex -g ondemand-dex -s /sbin/nologin -c "OnDemand Dex" ondemand-dex
47+
mkdir -p /etc/ood/dex
48+
tee /etc/ood/dex/config.yaml <<EOF
49+
---
50+
issuer: http://eb8307ff82be:5556
51+
storage:
52+
type: sqlite3
53+
config:
54+
file: "/etc/ood/dex/dex.db"
55+
web:
56+
http: 0.0.0.0:5556
57+
telemetry:
58+
http: 0.0.0.0:5558
59+
staticClients:
60+
- id: eb8307ff82be
61+
redirectURIs:
62+
- http://eb8307ff82be/oidc
63+
name: OnDemand
64+
secret: 7c6c2f51-2f97-4866-886e-2fcf5b974224
65+
oauth2:
66+
skipApprovalScreen: true
67+
enablePasswordDB: true
68+
staticPasswords:
69+
- email: ood@localhost
70+
hash: "$2a$10$2b2cU8CPhOTaGrs1HRQuAueS7JTT5ZHsHSzYiFPm1leZck7Mc8T4W"
71+
username: ood
72+
userID: '08a8684b-db88-4b73-90a9-3cd1661f5466'
73+
frontend:
74+
dir: "/usr/share/ondemand-dex/web"
75+
theme: hpc-coop
76+
EOF
77+
fi
1878

1979
log_info "Setting up Ondemand"
2080
mkdir -p /etc/ood/config/clusters.d
@@ -81,15 +141,17 @@ dex:
81141
theme: ondemand
82142
EOF
83143

84-
log_info "Generating new httpd24 and dex configs.."
85-
/opt/ood/ood-portal-generator/sbin/update_ood_portal
144+
if [[ ${ARCHTYPE} = "x86_64" ]]; then
145+
log_info "Generating new httpd24 and dex configs.."
146+
/opt/ood/ood-portal-generator/sbin/update_ood_portal
147+
148+
log_info "Adding new theme to dex"
149+
sed -i "s/theme: ondemand/theme: hpc-coop/g" /etc/ood/dex/config.yaml
150+
fi
86151

87152
dnf clean all
88153
rm -rf /var/cache/dnf
89154

90-
log_info "Adding new theme to dex"
91-
sed -i "s/theme: ondemand/theme: hpc-coop/g" /etc/ood/dex/config.yaml
92-
93155
log_info "Cloning repos to assist with app development.."
94156
mkdir -p /var/git
95157
git clone https://github.com/OSC/bc_example_jupyter.git --bare /var/git/bc_example_jupyter

slurm/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ ARG TARGETARCH
99
FROM stage-${TARGETARCH} as final
1010

1111
ARG SLURM_VERSION
12-
ARG TARGETARCH
1312
COPY . /build
1413
RUN /build/install.sh && rm -rf /build
1514
COPY slurm.conf /etc/slurm/slurm.conf

slurm/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ log_info() {
99

1010
SLURM_VERSION=${SLURM_VERSION:-21.08.8-2}
1111
WEBSOCKIFY_VERSION=${WEBSOCKIFY_VERSION:-0.8.0}
12-
TARGETARCH=${TARGETARCH:-amd64}
12+
ARCHTYPE=`uname -m`
1313

1414
log_info "Installing required packages for building slurm.."
1515
curl -o /etc/yum.repos.d/turbovnc.repo https://turbovnc.org/pmwiki/uploads/Downloads/TurboVNC.repo

0 commit comments

Comments
 (0)