?
This commit is contained in:
parent
c9450ed11e
commit
c5d27dd31e
28
Dockerfile
28
Dockerfile
@ -10,9 +10,6 @@ ENV CFLAGS="-static -O2" \
|
|||||||
CXXFLAGS="-static -O2" \
|
CXXFLAGS="-static -O2" \
|
||||||
LDFLAGS="-static"
|
LDFLAGS="-static"
|
||||||
|
|
||||||
# Create non-root user
|
|
||||||
RUN adduser -D -u 1000 builder
|
|
||||||
|
|
||||||
# Install build dependencies
|
# Install build dependencies
|
||||||
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
|
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
|
||||||
apk update && \
|
apk update && \
|
||||||
@ -49,30 +46,6 @@ RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repo
|
|||||||
xz-dev \
|
xz-dev \
|
||||||
crosstool-ng
|
crosstool-ng
|
||||||
|
|
||||||
# Create crosstool-ng config
|
|
||||||
RUN mkdir -p /tmp/ct-ng && \
|
|
||||||
chown -R builder:builder /tmp/ct-ng && \
|
|
||||||
cd /tmp/ct-ng && \
|
|
||||||
su builder -c "ct-ng aarch64-unknown-linux-musl" && \
|
|
||||||
su builder -c "sed -i 's/CT_MUSL_VERSION=\"1.2.4\"/CT_MUSL_VERSION=\"1.2.4\"/' .config" && \
|
|
||||||
su builder -c "sed -i 's/CT_GCC_VERSION=\"13.1.0\"/CT_GCC_VERSION=\"13.1.0\"/' .config" && \
|
|
||||||
su builder -c "sed -i 's/CT_BINUTILS_VERSION=\"2.41\"/CT_BINUTILS_VERSION=\"2.41\"/' .config" && \
|
|
||||||
su builder -c "sed -i 's/CT_LINUX_VERSION=\"6.1.28\"/CT_LINUX_VERSION=\"6.1.28\"/' .config" && \
|
|
||||||
su builder -c "sed -i 's/CT_PARALLEL_JOBS=0/CT_PARALLEL_JOBS=$(nproc)/' .config" && \
|
|
||||||
su builder -c "echo 'CT_EXTRA_CFLAGS_FOR_BUILD=\"-D_FILE_OFFSET_BITS=64\"' >> .config" && \
|
|
||||||
su builder -c "echo 'CT_EXTRA_CFLAGS_FOR_HOST=\"-D_LARGEFILE64_SOURCE\"' >> .config"
|
|
||||||
|
|
||||||
# Build the toolchain
|
|
||||||
RUN cd /tmp/ct-ng && \
|
|
||||||
su builder -c "unset CFLAGS CXXFLAGS LDFLAGS && ct-ng build"
|
|
||||||
|
|
||||||
# Install the toolchain
|
|
||||||
RUN mkdir -p /opt/cross && \
|
|
||||||
cp -r /tmp/ct-ng/.build/aarch64-unknown-linux-musl/* /opt/cross/ && \
|
|
||||||
rm -rf /tmp/ct-ng
|
|
||||||
|
|
||||||
# Add toolchain to PATH
|
|
||||||
ENV PATH="/opt/cross/bin:${PATH}"
|
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
# nlohmann/json (compiled static .a) #
|
# nlohmann/json (compiled static .a) #
|
||||||
@ -149,7 +122,6 @@ ENV LD=mold
|
|||||||
|
|
||||||
# Copy pre‑built static libs + headers and cross-compiler toolchain
|
# Copy pre‑built static libs + headers and cross-compiler toolchain
|
||||||
COPY --from=builder /usr/local /usr/local
|
COPY --from=builder /usr/local /usr/local
|
||||||
COPY --from=builder /opt/cross /opt/cross
|
|
||||||
|
|
||||||
# Add toolchain to PATH
|
# Add toolchain to PATH
|
||||||
ENV PATH="/opt/cross/bin:${PATH}"
|
ENV PATH="/opt/cross/bin:${PATH}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user