diff --git a/.github/workflows/visualizer.yml b/.github/workflows/visualizer.yml index 3a179fae7..07bfb594d 100644 --- a/.github/workflows/visualizer.yml +++ b/.github/workflows/visualizer.yml @@ -4,6 +4,11 @@ on: - 'main' tags: - 'visualizer/v*' + paths: + - visualizer/** + - .github/workflows/visualizer.yml + - .github/actions/deps/** + pull_request: paths: - visualizer/** @@ -27,7 +32,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install deps uses: ./.github/actions/deps @@ -71,7 +76,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install deps uses: ./.github/actions/deps @@ -104,11 +109,11 @@ jobs: always() && (needs.test.result == 'success' || needs.test.result == 'cancelled') && (needs.lint.result == 'success' || needs.lint.result == 'cancelled') - timeout-minutes: 30 + timeout-minutes: 300 runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - uses: actions-ecosystem/action-regex-match@v2 id: regex @@ -124,7 +129,7 @@ jobs: (if ! [[ "$t" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$t, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest; elif ! [[ "$m" == "" ]]; then echo tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$m; else echo tags=; fi) >> $GITHUB_OUTPUT - name: Login to GitHub Container Registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -132,19 +137,22 @@ jobs: - name: Extract metadata for Docker id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Build and push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: context: "visualizer" file: "visualizer/Dockerfile" push: ${{ steps.tags_extractor.outputs.tags != '' }} tags: ${{ steps.tags_extractor.outputs.tags }} + platforms: | + linux/amd64 + linux/arm64/v8 labels: ${{ steps.meta.outputs.labels }} cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-cache cache-to: ${{ github.ref == 'refs/heads/main' && format('type=registry,ref={0}/{1}:build-cache,mode=max', env.REGISTRY, env.IMAGE_NAME) || '' }} diff --git a/visualizer/Dockerfile b/visualizer/Dockerfile index 380f870cf..f44a339d2 100644 --- a/visualizer/Dockerfile +++ b/visualizer/Dockerfile @@ -1,17 +1,22 @@ -FROM lukemathwalker/cargo-chef:0.1.62-rust-1.72-buster as chef -RUN apt-get update && apt-get install -y curl wget unzip -WORKDIR /app +FROM lukemathwalker/cargo-chef:0.1.62-rust-1.74-buster as chef -# Install protoc -RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-x86_64.zip -O ./protoc.zip \ +WORKDIR /app +ARG TARGETARCH +RUN case ${TARGETARCH} in \ + "arm64") TARGETARCH=aarch_64 ;; \ + "amd64") TARGETARCH=x86_64 ;; \ + esac \ + && wget https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-$TARGETARCH.zip -O ./protoc.zip \ && unzip protoc.zip \ && mv ./include/* /usr/include/ \ && mv ./bin/protoc /usr/bin/protoc -# Install protoc-gen-openapiv2 -RUN wget https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v2.15.0/protoc-gen-openapiv2-v2.15.0-linux-x86_64 -O ./protoc-gen-openapiv2 \ - && chmod +x protoc-gen-openapiv2 \ - && mv ./protoc-gen-openapiv2 /usr/bin/protoc-gen-openapiv2 +RUN case ${TARGETARCH} in \ + "amd64") TARGETARCH=x86_64 ;; \ + esac \ + && wget https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v2.15.0/protoc-gen-openapiv2-v2.15.0-linux-$TARGETARCH -O ./protoc-gen-openapiv2 \ + && chmod +x protoc-gen-openapiv2 \ + && mv ./protoc-gen-openapiv2 /usr/bin/protoc-gen-openapiv2 FROM chef AS plan @@ -28,9 +33,8 @@ RUN cargo build --release FROM node:16-bullseye-slim WORKDIR /usr/src/ -# sol2uml needed phantom which installation needed bzip2 -RUN apt-get update && apt-get install bzip2 \ - && npm install phantom \ + +RUN apt-get update && apt-get install -y chromium \ && npm link sol2uml@2.1 --only=production COPY --from=build /app/target/release/visualizer-server ./