-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapt to multi-platform image building (#703)
Co-authored-by: mason <[email protected]>
- Loading branch information
Showing
3 changed files
with
20 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
FROM opencsg-registry.cn-beijing.cr.aliyuncs.com/opencsg_public/go-node AS build | ||
FROM --platform=$BUILDPLATFORM opencsg-registry.cn-beijing.cr.aliyuncs.com/opencsg_public/go-node AS builder | ||
ARG TARGETPLATFORM | ||
ARG BUILDPLATFORM | ||
|
||
RUN mkdir /myapp | ||
WORKDIR /myapp | ||
ADD . /myapp | ||
|
||
ENV CGO_ENABLED=0 | ||
RUN go mod tidy | ||
RUN cd frontend && yarn install && yarn build | ||
RUN go build -o csghub-portal ./cmd/csghub-portal | ||
RUN GOOS=$(echo ${TARGETPLATFORM} | cut -f1 -d '/') \ | ||
GOARCH=$(echo ${TARGETPLATFORM} | cut -f2 -d '/') \ | ||
go build -o csghub-portal ./cmd/csghub-portal | ||
|
||
FROM bitnami/minideb:latest | ||
RUN apt update && apt install -y ca-certificates && update-ca-certificates | ||
WORKDIR /myapp | ||
COPY --from=build /myapp/csghub-portal /myapp/csghub-portal | ||
COPY --from=builder /myapp/csghub-portal /myapp/csghub-portal |