Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
feat: add Dockerfile and docker push CI workflow (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiendan authored Aug 13, 2023
1 parent ab27609 commit e835d18
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 51 deletions.
51 changes: 0 additions & 51 deletions .github/workflows/deploy.yml

This file was deleted.

66 changes: 66 additions & 0 deletions .github/workflows/docker_build_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: docker_build_push

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
docker:
name: Build and push docker image to GitHub Container Registry
environment: devnet-1
runs-on: ubuntu-latest-16-core
outputs:
tags: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
with:
short-length: 7

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Push to GitHub Container Registry
uses: docker/build-push-action@v3
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
build-args: |
VITE_SUBNET_REGISTRATOR_CONTRACT_ADDRESS=${{ vars.VITE_SUBNET_REGISTRATOR_CONTRACT_ADDRESS }}
VITE_TOPOS_CORE_CONTRACT_ADDRESS=${{ vars.VITE_TOPOS_CORE_CONTRACT_ADDRESS }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: |
type=registry,ref=${{ env.REGISTRY }}/${{ github.repository }}:build-cache-${{ env.GITHUB_REF_SLUG_URL }}-${{ github.workflow }}
type=registry,ref=${{ env.REGISTRY }}/${{ github.repository }}:build-cache-main-${{ github.workflow }}
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository }}:build-cache-${{ env.GITHUB_REF_SLUG_URL }}-${{ github.workflow }},mode=max
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:lts-alpine

ARG VITE_SUBNET_REGISTRATOR_CONTRACT_ADDRESS
ARG VITE_TOPOS_CORE_CONTRACT_ADDRESS

WORKDIR /usr/src/app

COPY package*.json ./

RUN npm ci

COPY . ./

RUN npm run build

CMD npm run preview -- --port 80 --host 0.0.0.0

0 comments on commit e835d18

Please sign in to comment.