Skip to content

Commit

Permalink
Add platforms for visualizer (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenzing authored Jan 18, 2024
1 parent f2977f5 commit 30b6961
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 20 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/visualizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
- 'main'
tags:
- 'visualizer/v*'
paths:
- visualizer/**
- .github/workflows/visualizer.yml
- .github/actions/deps/**

pull_request:
paths:
- visualizer/**
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -124,27 +129,30 @@ 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 }}
password: ${{ secrets.GITHUB_TOKEN }}

- 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) || '' }}
28 changes: 16 additions & 12 deletions visualizer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 [email protected] --only=production

COPY --from=build /app/target/release/visualizer-server ./
Expand Down

0 comments on commit 30b6961

Please sign in to comment.