parent
3ff722bf9f
commit
40e55399ff
52
Dockerfile
52
Dockerfile
@ -1,16 +1,17 @@
|
||||
FROM gitea.okami101.io/okami101/stagex/core-binutils:latest AS binutils
|
||||
FROM gitea.okami101.io/okami101/stagex/core-gcc:latest AS gcc
|
||||
FROM gitea.okami101.io/okami101/stagex/core-make:latest AS make
|
||||
FROM gitea.okami101.io/okami101/stagex/core-musl:latest AS musl
|
||||
FROM gitea.okami101.io/okami101/stagex/core-busybox:latest AS busybox
|
||||
FROM gitea.okami101.io/okami101/stagex/core-diffutils:latest AS diffutils
|
||||
FROM gitea.okami101.io/okami101/stagex/core-binutils:latest AS core-binutils
|
||||
FROM gitea.okami101.io/okami101/stagex/core-gcc:latest AS core-gcc
|
||||
FROM gitea.okami101.io/okami101/stagex/core-make:latest AS core-make
|
||||
FROM gitea.okami101.io/okami101/stagex/core-musl:latest AS core-musl
|
||||
FROM gitea.okami101.io/okami101/stagex/core-busybox:latest AS core-busybox
|
||||
FROM gitea.okami101.io/okami101/stagex/core-diffutils:latest AS core-diffutils
|
||||
FROM gitea.okami101.io/okami101/stagex/core-go:latest AS core-go
|
||||
|
||||
FROM scratch AS bootstrap-c-toolchain
|
||||
COPY --from=binutils / /
|
||||
COPY --from=gcc / /
|
||||
COPY --from=make / /
|
||||
COPY --from=musl / /
|
||||
COPY --from=busybox / /
|
||||
COPY --from=core-binutils / /
|
||||
COPY --from=core-gcc / /
|
||||
COPY --from=core-make / /
|
||||
COPY --from=core-musl / /
|
||||
COPY --from=core-busybox / /
|
||||
|
||||
FROM bootstrap-c-toolchain AS build-make
|
||||
ARG VERSION=4.4.1
|
||||
@ -131,7 +132,7 @@ RUN mkdir -p /rootfs/usr/include && \
|
||||
cp -rv usr/include/* /rootfs/usr/include
|
||||
|
||||
FROM bootstrap-c-toolchain AS build-musl
|
||||
COPY --from=diffutils / /
|
||||
COPY --from=core-diffutils / /
|
||||
|
||||
ENV CFLAGS=""
|
||||
ENV CXXFLAGS=""
|
||||
@ -161,9 +162,36 @@ RUN cd build && \
|
||||
ln -sf ld-musl-${ARCH}.so.1 /rootfs/usr/lib/libc.musl-${ARCH}.so.1 && \
|
||||
ln -sf /usr/lib/ld-musl-${ARCH}.so.1 /rootfs/usr/lib/libc.so
|
||||
|
||||
FROM core-busybox AS build-go
|
||||
COPY --from=core-go / /
|
||||
ARG VERSION=1.24.2
|
||||
ENV GOROOT_FINAL=/rootfs/go
|
||||
|
||||
WORKDIR /source
|
||||
|
||||
RUN wget https://dl.google.com/go/go${VERSION}.src.tar.gz -O go.src.tar.gz
|
||||
|
||||
RUN tar -xzf go.src.tar.gz --strip-components=1 && \
|
||||
rm go.src.tar.gz
|
||||
|
||||
RUN cd src && sh make.bash
|
||||
|
||||
RUN rm -rf pkg/obj && \
|
||||
rm -rf pkg/bootstrap && \
|
||||
rm -f pkg/tool/*/api && \
|
||||
find src \( -type f -a -name "*_test.go" \) -exec rm -rf \{\} \+ && \
|
||||
find src \( -type d -a -name "testdata" \) -exec rm -rf \{\} \+ && \
|
||||
find src -type f -a \( -name "*.bash" -o -name "*.rc" -o -name "*.bat" \) -exec rm -rf \{\} \+ && \
|
||||
mkdir -p "${GOROOT_FINAL}" && \
|
||||
mv * "${GOROOT_FINAL}" && \
|
||||
mkdir -p /rootfs/usr/bin && \
|
||||
ln -s /go/bin/go /rootfs/usr/bin/go && \
|
||||
ln -s /go/bin/gofmt /rootfs/usr/bin/gofmt
|
||||
|
||||
FROM busybox AS final
|
||||
COPY --from=build-make /rootfs/ /
|
||||
COPY --from=build-binutils /rootfs/ /
|
||||
COPY --from=build-gcc /rootfs/ /
|
||||
COPY --from=build-linux-headers /rootfs/ /
|
||||
COPY --from=build-musl /rootfs/ /
|
||||
COPY --from=build-go /rootfs/ /
|
||||
|
Loading…
x
Reference in New Issue
Block a user