feat: add Dockerfile to build the package of golang.

This commit is contained in:
tulip
2024-12-30 20:43:57 +08:00
parent 7449b05f62
commit cdcf66bc1f
4 changed files with 35 additions and 1 deletions
+2
View File
@@ -0,0 +1,2 @@
# 排除特定文件
output/
+3
View File
@@ -54,3 +54,6 @@ dist/
pubspec.lock
Podfile.lock
#docker
output/
+25
View File
@@ -0,0 +1,25 @@
FROM gcc:11.5.0 AS builder
RUN apt-get update && apt-get install cmake -y
WORKDIR /MMKV
COPY . .
## 设置环境变量
#ENV CGO_ENABLED='1'
#ENV CGO_CFLAGS='-static -O2 -g'
#ENV CGO_LDFLAGS='-static -O2 -g'
WORKDIR /MMKV/POSIX/golang
RUN mkdir -p build && cd build && rm -rf ./* && \
cmake .. -DCMAKE_INSTALL_PREFIX=. \
-DCMAKE_BUILD_TYPE=Release && \
make -j8 install
RUN uname -a > /MMKV/POSIX/golang/build/tencent.com/build_info.txt 2>&1 && \
gcc -v >> /MMKV/POSIX/golang/build/tencent.com/build_info.txt 2>&1 && \
cmake --version >> /MMKV/POSIX/golang/build/tencent.com/build_info.txt 2>&1
FROM scratch AS export-stage
COPY --from=builder /MMKV/POSIX/golang/build/tencent.com /tencent.com
+5 -1
View File
@@ -1,2 +1,6 @@
format_code:
python Script/formatCode.py
python Script/formatCode.py
golang:
docker pull --platform=$(PLATFORM) gcc:11.5.0
docker buildx build --platform=$(PLATFORM) --target export-stage --output type=local,dest=./output/$(PLATFORM) .