diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c7d925f..ef2e4e5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,40 +18,40 @@ jobs: - name: Check out code uses: actions/checkout@v3 - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: 14 + # - name: Setup node + # uses: actions/setup-node@v3 + # with: + # node-version: 14 - - name: Build admin - env: - host: 'ubuntu@en.dtm.pub' - dest: '/data/dtm-admin/' - run: | - cd admin - npm install -g yarn - yarn - VITE_ADMIN_VERSION=${{ env.RELEASE_VERSION }} yarn build - echo "${{secrets.DEPLOY_KEY}}" > deploy_key - chmod 600 ./deploy_key - tar -cvzf dist.tar.gz dist - scp -i deploy_key -o StrictHostKeyChecking=no dist.tar.gz ${{env.host}}:${{env.dest}} - ssh -i deploy_key -o StrictHostKeyChecking=no ${{env.host}} 'cd ${{env.dest}} && tar -zvxf dist.tar.gz' - rm deploy_key dist.tar.gz - echo > dist/placeholder - cd .. + # - name: Build admin + # env: + # host: 'ubuntu@en.dtm.pub' + # dest: '/data/dtm-admin/' + # run: | + # cd admin + # npm install -g yarn + # yarn + # VITE_ADMIN_VERSION=${{ env.RELEASE_VERSION }} yarn build + # echo "${{secrets.DEPLOY_KEY}}" > deploy_key + # chmod 600 ./deploy_key + # tar -cvzf dist.tar.gz dist + # scp -i deploy_key -o StrictHostKeyChecking=no dist.tar.gz ${{env.host}}:${{env.dest}} + # ssh -i deploy_key -o StrictHostKeyChecking=no ${{env.host}} 'cd ${{env.dest}} && tar -zvxf dist.tar.gz' + # rm deploy_key dist.tar.gz + # echo > dist/placeholder + # cd .. - - name: Validates GO releaser config - uses: docker://goreleaser/goreleaser:v1.7.0 - with: - args: check + # - name: Validates GO releaser config + # uses: docker://goreleaser/goreleaser:v1.7.0 + # with: + # args: check - - name: Create release on GitHub - uses: docker://goreleaser/goreleaser:v1.7.0 - with: - args: release -f helper/.goreleaser.yml --rm-dist - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + # - name: Create release on GitHub + # uses: docker://goreleaser/goreleaser:v1.7.0 + # with: + # args: release -f helper/.goreleaser.yml --rm-dist + # env: + # GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: Create Docker id: meta diff --git a/helper/Dockerfile-release b/helper/Dockerfile-release index da9a40d..846c09b 100644 --- a/helper/Dockerfile-release +++ b/helper/Dockerfile-release @@ -1,12 +1,11 @@ # syntax=docker/dockerfile:1 -FROM node:14.5.0-alpine as bulder1 +FROM node:14.5.0-alpine as builder1 ARG RELEASE_VERSION WORKDIR /app/dtm COPY . . -RUN cd admin && yarn -RUN VITE_ADMIN_VERSION=$RELEASE_VERSION yarn build +RUN cd admin && yarn && VITE_ADMIN_VERSION=$RELEASE_VERSION yarn build -FROM --platform=$TARGETPLATFORM golang:1.16-alpine as builder +FROM --platform=$TARGETPLATFORM golang:1.16-alpine as builder2 ARG TARGETARCH ARG TARGETOS ARG RELEASE_VERSION @@ -14,10 +13,10 @@ WORKDIR /app/dtm # RUN go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct EXPOSE 8080 COPY . . -COPY --from=bulder1 /app/dtm/admin/dist /app/dtm/admin +COPY --from=builder1 /app/dtm/admin/dist /app/dtm/admin RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-s -w -X main.Version=$RELEASE_VERSION" FROM --platform=$TARGETPLATFORM alpine -COPY --from=builder /app/dtm/dtm /app/dtm/ +COPY --from=builder2 /app/dtm/dtm /app/dtm/ WORKDIR /app/dtm ENTRYPOINT ["/app/dtm/dtm"]