1
1
# syntax=docker/dockerfile-upstream:master
2
+ # check=error=true
2
3
3
4
ARG GO_VERSION=1.22
4
5
ARG ALPINE_VERSION=3.20
5
6
ARG DEBIAN_VERSION=trixie
6
7
8
+ ARG BUILD_LOONG64=${TARGETPLATFORM#linux/amd64}
9
+ ARG BUILD_LOONG64=${BUILD_LOONG64:+"unsupported" }
10
+ ARG BUILD_LOONG64=${BUILD_LOONG64:-"supported" }
11
+
7
12
FROM debian:${DEBIAN_VERSION}-slim AS base
8
13
RUN apt-get update && apt-get --no-install-recommends install -y git binutils \
9
14
gcc-x86-64-linux-gnu \
@@ -15,8 +20,7 @@ RUN apt-get update && apt-get --no-install-recommends install -y git binutils \
15
20
binutils-s390x-linux-gnu \
16
21
binutils-powerpc64le-linux-gnu \
17
22
binutils-mips64el-linux-gnuabi64 \
18
- binutils-mips64-linux-gnuabi64 \
19
- binutils-loongarch64-linux-gnu
23
+ binutils-mips64-linux-gnuabi64
20
24
WORKDIR /src
21
25
22
26
FROM base AS exit-amd64
@@ -59,10 +63,16 @@ FROM base AS exit-mips64
59
63
COPY util/archutil/fixtures/exit.mips64.s .
60
64
RUN mips64-linux-gnuabi64-as --noexecstack -o exit.o exit.mips64.s && mips64-linux-gnuabi64-ld -o exit -s exit.o && mips64-linux-gnuabi64-strip --strip-unneeded exit
61
65
62
- FROM base AS exit-loong64
66
+ FROM base AS exit-loong64-base
67
+ RUN apt-get --no-install-recommends install -y binutils-loongarch64-linux-gnu
63
68
COPY util/archutil/fixtures/exit.loongarch64.s .
64
69
RUN loongarch64-linux-gnu-as --noexecstack -o exit.o exit.loongarch64.s && loongarch64-linux-gnu-ld -o exit -s exit.o && loongarch64-linux-gnu-strip --strip-unneeded exit
65
70
71
+ FROM scratch AS exit-loong64-unsupported
72
+ FROM scratch AS exit-loong64-supported
73
+ COPY --from=exit-loong64-base /src/exit loong64
74
+ FROM exit-loong64-${BUILD_LOONG64} AS exit-loong64
75
+
66
76
FROM scratch AS exits
67
77
COPY --from=exit-amd64 /src/exit amd64
68
78
COPY --from=exit-386 /src/exit 386
@@ -74,10 +84,11 @@ COPY --from=exit-ppc64 /src/exit ppc64
74
84
COPY --from=exit-ppc64le /src/exit ppc64le
75
85
COPY --from=exit-mips64le /src/exit mips64le
76
86
COPY --from=exit-mips64 /src/exit mips64
77
- COPY --from=exit-loong64 /src/exit loong64
87
+ COPY --from=exit-loong64 / /
78
88
79
89
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS generate
80
90
WORKDIR /go/src/github.com/moby/buildkit
91
+ ARG BUILD_LOONG64
81
92
RUN --mount=type=bind,target=.,rw \
82
93
--mount=from=exits,target=./bin/archutil,rw <<EOT
83
94
set -ex
@@ -92,8 +103,8 @@ RUN --mount=type=bind,target=.,rw \
92
103
bin/archutil/ppc64 \
93
104
bin/archutil/ppc64le \
94
105
bin/archutil/mips64le \
95
- bin/archutil/mips64 \
96
- bin/archutil/loong64
106
+ bin/archutil/mips64
107
+ [ "${BUILD_LOONG64}" = "unsupported" ] || go run ./util/archutil/generate.go bin/archutil/loong64
97
108
tree -nh bin/archutil
98
109
cp bin/archutil/*_binary.go /out
99
110
EOT
@@ -109,7 +120,7 @@ RUN --mount=type=bind,target=.,rw \
109
120
if [ "$(ls -A /generated-files)" ]; then
110
121
cp -rf /generated-files/* ./util/archutil
111
122
fi
112
- diff=$(git status --porcelain)
123
+ diff=$(git status --porcelain -- util/archutil )
113
124
if [ -n "$diff" ]; then
114
125
echo >&2 'ERROR: The result of archutil differs. Please update with "make archutil"'
115
126
echo "$diff"
0 commit comments