-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: dockerfile, build and publish job
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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;"] |