Skip to content

Commit

Permalink
feat: dockerfile, build and publish job
Browse files Browse the repository at this point in the history
  • Loading branch information
toliaqat committed Sep 11, 2024
1 parent 78113bd commit 18c8ec3
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Docker Image CI

on:
push:
branches: [ "master" ]

env:
REGISTRY: ghcr.io

jobs:
build:
permissions:
contents: read
packages: write

runs-on: ubuntu-latest
strategy:
matrix:
platform:
- linux/amd64
- linux/arm64/v8

steps:
- uses: actions/checkout@v3
- name: Save BUILD_TAG
run: |
TIMESTAMP=`date +%Y%m%d%H%M%S`
SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-6)
SNAPSHOT_TAG="${TIMESTAMP}-${SHORT_SHA}"
ARCH=$(echo '${{ matrix.platform }}' | tr / _)
echo "BUILD_TAG=$SNAPSHOT_TAG-$ARCH" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Registry
uses: docker/login-action@v2
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
- name: Build and Push setup
uses: docker/build-push-action@v3
with:
file: Dockerfile
context: .
platforms: ${{ matrix.platform }}
tags: '${{ env.REGISTRY }}/agoric/instagoric-dashboard:${{ env.BUILD_TAG }}'
push: true
build-args: |
TAG=${{ env.BUILD_TAG }}
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:16 as build

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

RUN npm run build

FROM nginx:alpine

COPY --from=build /app/build /usr/share/nginx/html

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]

0 comments on commit 18c8ec3

Please sign in to comment.