Merge pull request #83 from button-inc/chore/remove-rfs-and-ss #108
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
name: Build and push images | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
jobs: | ||
docker-build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- image: ghcr.io/button-inc/iot-system-prototype/app | ||
context: . | ||
dockerfile: app/Dockerfile | ||
name: app | ||
- image: ghcr.io/button-inc/iot-system-prototype/api | ||
context: . | ||
dockerfile: api/Dockerfile | ||
name: api | ||
build-args: | | ||
Check failure on line 22 in .github/workflows/build-and-push.yaml GitHub Actions / Build and push imagesInvalid workflow file
|
||
"BB_TOKEN=${{ secrets.BB_TOKEN }}" | ||
name: Build ${{ matrix.name }} docker image | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
install: true | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ matrix.image }} | ||
tags: | | ||
type=sha,format=long,prefix= | ||
latest | ||
type=ref,event=pr | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ matrix.name }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx-${{ matrix.name }} | ||
- name: Build image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ${{ matrix.context }} | ||
builder: ${{ steps.buildx.outputs.name }} | ||
push: true | ||
file: ${{ matrix.dockerfile }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
# Temp fix | ||
# https://github.com/docker/build-push-action/issues/252 | ||
# https://github.com/moby/buildkit/issues/1896 | ||
- name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |