加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Dockerfile 1.53 KB
一键复制 编辑 原始数据 按行查看 历史
kony 提交于 2024-12-26 09:31 . u
FROM --platform=${BUILDPLATFORM} golang:latest AS builder
RUN echo 'Acquire::http::proxy "http://172.17.0.1:7899";' | tee -a /etc/apt/apt.conf
RUN echo 'Acquire::https::proxy "http://172.17.0.1:7899";' | tee -a /etc/apt/apt.conf
RUN export GO111MODULE=on
RUN export GOPROXY=https://goproxy.cn,direct
RUN apt update \
&& apt upgrade -y \
&& apt install make -y \
&& apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends ca-certificates
WORKDIR /go/src/goodlink
COPY --from=tonistiigi/xx:golang / /
ARG TARGETOS TARGETARCH TARGETVARIANT
RUN echo 111111111111
COPY gogo /go/src/gogo
COPY goodlink2 /go/src/goodlink2
RUN --mount=target=. \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
make clean && \
make linux-amd64 BINDIR= ${TARGETOS}-${TARGETARCH}${TARGETVARIANT} && \
mv /goodlink* /goodlink
COPY upx /usr/bin/
RUN upx --best /goodlink
FROM --platform=${BUILDPLATFORM} scratch
#MAINTAINER 维护者信息
MAINTAINER kony
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /lib/x86_64-linux-gnu /lib/x86_64-linux-gnu
COPY --from=builder /lib64 /lib64
COPY --from=builder /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
COPY --from=builder /goodlink /home/
#WORKDIR 相当于cd
WORKDIR /home/
#ENTRYPOINT 运行命令+固定参数
ENTRYPOINT ["./goodlink", "--gogo-restart-delay=2000"]
#CMD 可变参数, 会被docker run带入的参数替换
CMD ["--h"]
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化