Skip to content

Commit

Permalink
build admin before dtm
Browse files Browse the repository at this point in the history
  • Loading branch information
yedf2 committed Oct 15, 2023
1 parent 55e5a3b commit e704733
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions helper/Dockerfile-release
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
# COPY . .
# RUN cd admin && yarn && VITE_ADMIN_VERSION=$RELEASE_VERSION yarn build

FROM --platform=$TARGETPLATFORM golang:1.18-alpine as builder1
FROM --platform=amd64 node as builder2
ARG TARGETARCH
ARG TARGETOS
ARG RELEASE_VERSION
WORKDIR /app/dtm
# RUN go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
COPY . .
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-s -w -X main.Version=$RELEASE_VERSION"
RUN cd admin && yarn && VITE_ADMIN_VERSION=$RELEASE_VERSION yarn build

FROM --platform=amd64 node as builder2
FROM --platform=$TARGETPLATFORM golang:1.18-alpine as builder1
ARG TARGETARCH
ARG TARGETOS
ARG RELEASE_VERSION
WORKDIR /app/dtm
# RUN go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
COPY . .
RUN cd admin && yarn && VITE_ADMIN_VERSION=$RELEASE_VERSION yarn build
COPY --from=builder2 /app/dtm/admin/dist /app/dtm/admin/dist
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-s -w -X main.Version=$RELEASE_VERSION"

FROM --platform=$TARGETPLATFORM alpine
COPY --from=builder1 /app/dtm/dtm /app/dtm/
COPY --from=builder2 /app/dtm/admin/dist /app/dtm/admin/dist
WORKDIR /app/dtm
EXPOSE 8080
ENTRYPOINT ["/app/dtm/dtm"]

0 comments on commit e704733

Please sign in to comment.