diff --git a/.github/workflows/push_image_next.yml b/.github/workflows/push_image_next.yml index 0afe2b017..66d1925ad 100644 --- a/.github/workflows/push_image_next.yml +++ b/.github/workflows/push_image_next.yml @@ -13,6 +13,32 @@ on: default: "next" jobs: + prepare-ui: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22.19.0 + + - name: Build UI + run: | + echo "VITE_APP_VERSION=${GITHUB_REF#refs/tags/}" > ./ui/.env + npm --prefix=./ui ci + npm --prefix=./ui run build + + - name: Upload UI build artifacts + uses: actions/upload-artifact@v4 + with: + name: ui-build + path: ./ui/dist + retention-days: 1 + build-and-push: runs-on: ubuntu-latest @@ -55,11 +81,17 @@ jobs: run: | echo "VITE_APP_VERSION=${GITHUB_REF#refs/tags/}" > ./ui/.env + - name: Download UI build artifacts + uses: actions/download-artifact@v4 + with: + name: ui-build + path: ./ui/dist + - name: Build and push Docker image uses: docker/build-push-action@v6 with: context: . - file: ./Dockerfile + file: ./Dockerfile.gh platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c88751c86..d3ef2cc90 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: 20.11.0 + node-version: 22.19.0 - name: Build UI run: | diff --git a/Dockerfile b/Dockerfile index 6f0f709bb..6485e54ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN \ -FROM golang:1.24-alpine AS builder +FROM golang:1.24-alpine AS server-builder WORKDIR /app COPY ../. /app/ RUN rm -rf /app/ui/dist @@ -20,5 +20,5 @@ RUN go build -ldflags="-s -w" -o certimate FROM alpine:latest WORKDIR /app -COPY --from=builder /app/certimate . +COPY --from=server-builder /app/certimate . ENTRYPOINT ["./certimate", "serve", "--http", "0.0.0.0:8090"] diff --git a/Dockerfile.gh b/Dockerfile.gh new file mode 100644 index 000000000..0f1b7bc31 --- /dev/null +++ b/Dockerfile.gh @@ -0,0 +1,16 @@ +# Build docker image on GitHub Actions runner is too slow, +# and it doesn't support armv7 (see https://github.com/parcel-bundler/lightningcss/issues/988). +# So we pre-build webui, and just use simple Dockerfile here. + +FROM golang:1.24-alpine AS server-builder +WORKDIR /app +COPY ../. /app/ +ENV CGO_ENABLED=0 +RUN go build -ldflags="-s -w" -o certimate + + + +FROM alpine:latest +WORKDIR /app +COPY --from=server-builder /app/certimate . +ENTRYPOINT ["./certimate", "serve", "--http", "0.0.0.0:8090"]