Update .github/workflows/test_building_containers.yaml #11
Workflow file for this run
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
# This is a workflow to build images | |
name: Build Docker Images | |
on: [push, workflow_dispatch] | |
jobs: | |
build-frontend: | |
# TODO: move these four repetitive jobs into a shared parameterized github action | |
name: Build Frontend Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to container registry | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | |
registry: docker.io | |
# So now you can use Actions' own caching! | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build Image to verify it works but don't push | |
uses: docker/build-push-action@v3 | |
with: | |
tags: docker.io/groundlight/monitoring-notification-server-frontend:latest | |
platforms: linux/amd64,linux/arm64 | |
file: ./frontend.Dockerfile | |
push: false | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
build-frontend-armv7: | |
name: Build Frontend armv7 Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to container registry | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | |
registry: docker.io | |
# So now you can use Actions' own caching! | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build Image to verify it works but don't push | |
uses: docker/build-push-action@v3 | |
with: | |
tags: docker.io/groundlight/monitoring-notification-server-frontend:armv7-latest | |
platforms: linux/arm/v7 | |
file: ./frontend-armv7.Dockerfile | |
push: false | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
build-backend: | |
name: Build Backend Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to container registry | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | |
registry: docker.io | |
# So now you can use Actions' own caching! | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build Image to verify it works but don't push | |
uses: docker/build-push-action@v3 | |
with: | |
tags: docker.io/groundlight/monitoring-notification-server-backend:latest | |
platforms: linux/amd64,linux/arm64 | |
file: ./backend.Dockerfile | |
push: false | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
build-backend-armv7: | |
name: Build Backend armv7 Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to container registry | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | |
registry: docker.io | |
# So now you can use Actions' own caching! | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build and Push Image | |
uses: docker/build-push-action@v3 | |
with: | |
tags: docker.io/groundlight/monitoring-notification-server-backend:armv7-latest | |
platforms: linux/arm/v7 | |
file: ./backend-armv7.Dockerfile | |
push: false | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
# go here (https://evilmartians.com/chronicles/build-images-on-github-actions-with-docker-layer-caching) | |
# if cache is overflowing and is breaking |