Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
snail2sky authored Oct 24, 2024
1 parent d31663a commit 34a0fbd
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
ARG IMAGE=golang:1.22
ARG GOPROXY
ARG GOOS
ARG GOARCH

FROM $IMAGE as builder

WORKDIR /data0/src/bbx

COPY . .

ENV GOPROXY=${GOPROXY:-goproxy.io} GOOS=${GOOS:-linux} GOARCH=${GOARCH:-amd64}

RUN echo build for $GOOS $GOARCH

# 静态编译
RUN go build -ldflags '-linkmode "external" -extldflags "-static"'
# RUN go build -ldflags '-linkmode "external" -extldflags "-static"'
RUN go build

FROM alpine as runner

WORKDIR /data0/apps/bbx

COPY --from=builder /data0/src/bbx/bbx /data0/apps/bbx/

ENTRYPOINT ["/data0/apps/bbx/bbx"]
ENTRYPOINT ["/data0/apps/bbx/bbx"]

0 comments on commit 34a0fbd

Please sign in to comment.