mirror of
https://github.com/coaidev/coai.git
synced 2025-05-19 04:50:14 +09:00
fix: build error on arm64
This commit is contained in:
parent
bd7987bb64
commit
f2e575d98d
28
Dockerfile
28
Dockerfile
@ -13,12 +13,32 @@ ARG TARGETARCH
|
|||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
ENV GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on CGO_ENABLED=1
|
ENV GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on CGO_ENABLED=1
|
||||||
|
|
||||||
# Install dependencies for cgo
|
# Install build dependencies and cross-compilation toolchain
|
||||||
RUN apk add --no-cache gcc musl-dev
|
RUN apk add --no-cache \
|
||||||
|
gcc \
|
||||||
|
musl-dev \
|
||||||
|
g++ \
|
||||||
|
make \
|
||||||
|
linux-headers \
|
||||||
|
wget \
|
||||||
|
tar \
|
||||||
|
&& if [ "$TARGETARCH" = "arm64" ]; then \
|
||||||
|
wget -q -O /tmp/cross.tgz https://musl.cc/aarch64-linux-musl-cross.tgz && \
|
||||||
|
tar -xf /tmp/cross.tgz -C /usr/local && \
|
||||||
|
rm /tmp/cross.tgz; \
|
||||||
|
fi
|
||||||
|
|
||||||
# Build backend
|
# Build backend
|
||||||
RUN go install && \
|
RUN if [ "$TARGETARCH" = "arm64" ]; then \
|
||||||
go build .
|
CC=/usr/local/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc \
|
||||||
|
CGO_ENABLED=1 \
|
||||||
|
GOOS=linux \
|
||||||
|
GOARCH=arm64 \
|
||||||
|
go build -o chat -a -ldflags="-extldflags=-static" .; \
|
||||||
|
else \
|
||||||
|
go install && \
|
||||||
|
go build .; \
|
||||||
|
fi
|
||||||
|
|
||||||
FROM node:18 AS frontend
|
FROM node:18 AS frontend
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user