Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add AMD/ARM 64 images for the docker action. #34

Merged
merged 2 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 4 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,6 @@ env:

jobs:
Build-and-Publish:
strategy:
fail-fast: true
matrix:
env: [ "znet" ]
include:
- env: "znet"
NEXT_PUBLIC_GRAPHQL_URL: "http://localhost:8080/v1/graphql"
NEXT_PUBLIC_GRAPHQL_WS: "ws://localhost:8080/v1/graphql"
NEXT_PUBLIC_URL: "http://localhost:3030"
NEXT_PUBLIC_RPC_WEBSOCKET: "ws://localhost:26657/websocket"
NEXT_PUBLIC_CHAIN_TYPE: "devnet"
NODE_ENV: "production"
PROJECT_NAME: "web-coreum"
PORT: "3000"
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -34,7 +20,7 @@ jobs:
- name: Set Env
run: |
echo "BUILD_SHA=${GITHUB_SHA::8}" >> $GITHUB_ENV
export FULL_IMAGE_NAME_WITH_GIT_TAG=${{ (startsWith(github.ref, 'refs/tags/') && format('{0}/{1}:{2}-{3}', env.ORG, env.REPO, matrix.env, github.ref_name)) || '' }}
export FULL_IMAGE_NAME_WITH_GIT_TAG=${{ (startsWith(github.ref, 'refs/tags/') && format('{0}/{1}:{2}', env.ORG, env.REPO, github.ref_name)) || '' }}
echo "FULL_IMAGE_NAME_WITH_GIT_TAG=$FULL_IMAGE_NAME_WITH_GIT_TAG" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -44,25 +30,17 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
${{ env.ORG }}/${{ env.REPO }}:${{ env.BUILD_SHA }}
${{ env.ORG }}/${{ env.REPO }}:latest
${{ env.ORG }}/${{ env.REPO }}:znet-${{ env.BUILD_SHA }}
${{ env.ORG }}/${{ env.REPO }}:znet-latest
${{ env.FULL_IMAGE_NAME_WITH_GIT_TAG }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
push: true
build-args: |
"NEXT_PUBLIC_GRAPHQL_URL=${{ matrix.NEXT_PUBLIC_GRAPHQL_URL }}"
"NEXT_PUBLIC_GRAPHQL_WS=${{ matrix.NEXT_PUBLIC_GRAPHQL_WS }}"
"NEXT_PUBLIC_URL=${{ matrix.NEXT_PUBLIC_URL }}"
"NEXT_PUBLIC_RPC_WEBSOCKET=${{ matrix.NEXT_PUBLIC_RPC_WEBSOCKET }}"
"NEXT_PUBLIC_CHAIN_TYPE=${{ matrix.NEXT_PUBLIC_CHAIN_TYPE }}"
"NODE_ENV=${{ matrix.NODE_ENV }}"
"PROJECT_NAME=${{ matrix.PROJECT_NAME }}"
"PORT=${{ matrix.PORT }}"
"PROJECT_NAME=web-coreum"
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ARG PROJECT_NAME=web
# - Stage 4: runner (final image for the web project, sets environment variables, starts the server)

# Stage: starter
FROM ${BASE_IMAGE} AS starter
FROM --platform=$BUILDPLATFORM ${BASE_IMAGE} AS starter
WORKDIR /app
RUN npm i -g turbo

Expand Down Expand Up @@ -80,7 +80,7 @@ RUN ([ -z "${NEXT_PUBLIC_SENTRY_DSN}" ] || yarn node packages/shared-utils/confi
################################################################################

# Stage: runner
FROM ${BASE_IMAGE} AS runner
FROM --platform=$TARGETPLATFORM ${BASE_IMAGE} AS runner

# Copying the files from the builder stage to the runner stage.
ARG PROJECT_NAME
Expand Down