Revela-App/.github/workflows/docker-image.yml
Nolan 4831239c9e
Docker Changes
-  Build off of fedora
     - Schedule builds every Sunday
     - Build and push to Docker Hub
     - Test in CI
     - Build for arm64 and amd64
     - Implement healthchecks
	 - Only 2 layers :D
	 - Base building can be moved to TN
  -  Introduce a docker-compose.yml
  -  Automatically check code with eslint GHA
  -  PR's are checked to ensure they run
  -  Gracefully handle SIGINT/SIGTERM
  -  Bump deps
  -  Add devcontainer
  -  Configure dependabot
2023-03-15 21:35:11 -07:00

70 lines
2 KiB
YAML

name: Build and Push to Docker Hub
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: "30 12 * * 0" # Run once every Sunday
env:
REPO: ultraviolet-node
PLATFORMS: linux/amd64,linux/arm64
jobs:
build_and_push_docker_images:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERUSERNAME }}
password: ${{ secrets.DOCKERPASSWORD }}
- name: Build Test Image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.REPO }}
tags: test
containerfiles: |
./docker/Dockerfile
build-args: |
NPM_BUILD=npm ci --omit=dev --frozen-lockfile
- name: Test
run: |
podman run --rm -d -p 8080:8080 localhost/${{ env.REPO }}:test
chmod +x ./docker/test.sh
./docker/test.sh -p 8080 -h 0.0.0.0 -t 15
- name: Install qemu
if: github.event_name != 'pull_request'
run: |
sudo apt-get install -y qemu-user-static
- name: Build Production Images
if: github.event_name != 'pull_request'
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.REPO }}
tags: latest ${{ github.sha }}
containerfiles: |
./docker/Dockerfile
platforms: ${{ env.PLATFORMS }}
build-args: |
NPM_BUILD=npm ci --omit=dev --frozen-lockfile
- name: Push To Docker Hub
if: github.event_name != 'pull_request'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: docker.io/${{ secrets.DOCKERUSERNAME }}