2020-07-15 22:00:53 +02:00
|
|
|
name: CI for docker images
|
|
|
|
|
|
|
|
# Only run when docker paths change
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [dev, beta, master]
|
|
|
|
paths:
|
|
|
|
- 'docker/**'
|
|
|
|
- '.github/workflows/**'
|
|
|
|
|
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- 'docker/**'
|
|
|
|
- '.github/workflows/**'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
check-docker:
|
|
|
|
name: Build docker containers
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
2020-09-29 19:50:06 +02:00
|
|
|
fail-fast: false
|
2020-07-15 22:00:53 +02:00
|
|
|
matrix:
|
|
|
|
arch: [amd64, armv7, aarch64]
|
|
|
|
build_type: ["hassio", "docker"]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up env variables
|
|
|
|
run: |
|
2021-06-07 21:02:31 +02:00
|
|
|
base_version="3.1.0"
|
2020-07-15 22:00:53 +02:00
|
|
|
|
|
|
|
if [[ "${{ matrix.build_type }}" == "hassio" ]]; then
|
|
|
|
build_from="esphome/esphome-hassio-base-${{ matrix.arch }}:${base_version}"
|
|
|
|
build_to="esphome/esphome-hassio-${{ matrix.arch }}"
|
|
|
|
dockerfile="docker/Dockerfile.hassio"
|
|
|
|
else
|
|
|
|
build_from="esphome/esphome-base-${{ matrix.arch }}:${base_version}"
|
|
|
|
build_to="esphome/esphome-${{ matrix.arch }}"
|
|
|
|
dockerfile="docker/Dockerfile"
|
|
|
|
fi
|
|
|
|
|
2020-11-01 23:49:08 +01:00
|
|
|
echo "BUILD_FROM=${build_from}" >> $GITHUB_ENV
|
|
|
|
echo "BUILD_TO=${build_to}" >> $GITHUB_ENV
|
|
|
|
echo "DOCKERFILE=${dockerfile}" >> $GITHUB_ENV
|
2020-07-15 22:00:53 +02:00
|
|
|
- name: Pull for cache
|
|
|
|
run: |
|
|
|
|
docker pull "${BUILD_TO}:dev" || true
|
|
|
|
- name: Register QEMU binfmt
|
2021-03-20 20:58:46 +01:00
|
|
|
run: docker run --rm --privileged multiarch/qemu-user-static:5.2.0-2 --reset -p yes
|
2020-07-15 22:00:53 +02:00
|
|
|
- run: |
|
|
|
|
docker build \
|
|
|
|
--build-arg "BUILD_FROM=${BUILD_FROM}" \
|
|
|
|
--build-arg "BUILD_VERSION=ci" \
|
|
|
|
--cache-from "${BUILD_TO}:dev" \
|
|
|
|
--file "${DOCKERFILE}" \
|
|
|
|
.
|