Skip to content

Commit 62c33da

Browse files
committed
Use $TARGETPLATFORM in Dockerfile instead of RUBY_PLATFORM
RUBY_PLATFORM corresponds to $BUILDPLATFORM, but we need $TARGETPLATFORM actually. This is because we use the cache from the ARM64 system to build the ARM64 image on X86_64.
1 parent df65ec5 commit 62c33da

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Dockerfile.mri.erb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<% image = "ubuntu:20.04" %>
22
FROM <%= image %>
33

4+
ARG TARGETPLATFORM
5+
46
##
57
## Install required base packages for compiling ruby
68
##
@@ -25,11 +27,23 @@ COPY --from=larskanis/mingw64-ucrt:20.04 \
2527
RUN dpkg -i /debs/*.deb
2628

2729
<% elsif platform =~ /aarch64-mingw-ucrt/ %>
28-
RUN wget https://github.com/mstorsjo/llvm-mingw/releases/download/20250114/llvm-mingw-20250114-ucrt-ubuntu-20.04-<%= RUBY_PLATFORM[/^\w+/] %>.tar.xz && \
30+
31+
RUN echo $TARGETPLATFORM
32+
RUN <<EOF
33+
if [ "$TARGETPLATFORM" = "linux/amd64" ]; then
34+
DOWNLOAD_PLATFORM="x86_64";
35+
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then
36+
DOWNLOAD_PLATFORM="aarch64";
37+
else
38+
echo "Unsupported platform $TARGETPLATFORM";
39+
exit 1;
40+
fi &&
41+
wget https://github.com/mstorsjo/llvm-mingw/releases/download/20250114/llvm-mingw-20250114-ucrt-ubuntu-20.04-$DOWNLOAD_PLATFORM.tar.xz && \
2942
tar xf llvm-mingw*.tar.xz && \
3043
mv `ls -d llvm-mingw-*/` /llvm-mingw && \
3144
echo "export PATH=/llvm-mingw/bin:\$PATH" >> /etc/rubybashrc && \
3245
rm -r /llvm-mingw/bin/i686-w64* /llvm-mingw/bin/armv7-w64* /llvm-mingw/bin/x86_64-w64* /llvm-mingw/i686-w64* /llvm-mingw/armv7-w64* /llvm-mingw/x86_64-w64*
46+
EOF
3347

3448
<% elsif platform =~ /linux-musl/ %>
3549
COPY build/mk_musl_cross.sh /tmp

0 commit comments

Comments
 (0)