Skip to content

Merge pull request #2908 from jeedom/beta #514

Merge pull request #2908 from jeedom/beta

Merge pull request #2908 from jeedom/beta #514

name: Docker Hub Image CI Builder
on:
push:
# only trigger CI when push on following branches
branches:
- 'master'
# this is to manually trigger the worklow
workflow_dispatch:
inputs:
logLevel:
description: 'Reason'
default: 'Manual launch'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Free disk space
run: |
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo apt-get autoclean -y 2>&1
docker rmi $(docker image ls -aq) 2>&1
df -h
- name: Check Out Repo
# Check out the repo, using current branch
# https://github.com/marketplace/actions/checkout
uses: actions/checkout@v3
- name: BRANCH name
# adding infos in the $GITHUB_ENV file and summary
# secret DOCKER_HUB_REPO is optional (default=jeedom)
run: |
export DOCKER_HUB_REPO=${{ secrets.DOCKER_HUB_REPO }}
bash install/OS_specific/Docker/init_workflow.sh
- name: Set up QEMU
# https://github.com/marketplace/actions/docker-setup-qemu
# set up more platforms (default = all)
uses: docker/setup-qemu-action@v2
- name: Login to Docker Hub
# https://github.com/marketplace/actions/docker-login
# login to DockerHub with secrets login & token
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
# https://github.com/marketplace/actions/docker-setup-buildx
# set up a multi-platform builder for Docker containers
id: buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
# https://github.com/marketplace/actions/cache
# this action allows caching dependancies and build output
uses: actions/cache@v3
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push Jeedom on Debian:Bookworm without internal DB
# https://github.com/marketplace/actions/build-and-push-docker-images
uses: docker/build-push-action@v3
continue-on-error: true
with:
context: ./
file: ./Dockerfile
platforms: linux/amd64,linux/arm64 # ,linux/arm/v7
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
build-args: |
"VERSION=${{ env.GITHUB_BRANCH }}"
"DEBIAN=bookworm"
"DATABASE=0"
tags: "${{ env.JEEDOM_REPO }}/jeedom:${{ env.JEEDOM_SHORT_VERSION}}-http-bookworm"
- name: Clean docker image
run: |
docker stop $(docker ps -aq) 2>&1
docker rm $(docker ps -aq) 2>&1
docker rmi $(docker image ls -aq) 2>&1
- name: Build and push Jeedom on DockerHub
# https://github.com/marketplace/actions/build-and-push-docker-images
uses: docker/build-push-action@v3
continue-on-error: true
with:
context: ./
file: ./Dockerfile
platforms: linux/amd64,linux/arm64 # ,linux/arm/v7
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
build-args: "VERSION=${{ env.GITHUB_BRANCH }}"
tags: "${{ env.JEEDOM_TAGS }}"
- name: Clean docker image
run: |
docker stop $(docker ps -aq) 2>&1
docker rm $(docker ps -aq) 2>&1
docker rmi $(docker image ls -aq) 2>&1
- name: Build and push Jeedom on Debian:Buster
# https://github.com/marketplace/actions/build-and-push-docker-images
uses: docker/build-push-action@v3
continue-on-error: true
with:
context: ./
file: ./Dockerfile
platforms: linux/amd64,linux/arm64 # ,linux/arm/v7
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
build-args: |
"VERSION=${{ env.GITHUB_BRANCH }}"
"DEBIAN=buster"
tags: "${{ env.JEEDOM_REPO }}/jeedom:${{ env.JEEDOM_SHORT_VERSION}}-buster"
- name: Clean docker image
run: |
docker stop $(docker ps -aq) 2>&1
docker rm $(docker ps -aq) 2>&1
docker rmi $(docker image ls -aq) 2>&1
- name: Build and push Jeedom on Debian:Bookworm
# https://github.com/marketplace/actions/build-and-push-docker-images
uses: docker/build-push-action@v3
continue-on-error: true
with:
context: ./
file: ./Dockerfile
platforms: linux/amd64,linux/arm64 # ,linux/arm/v7
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
build-args: |
"VERSION=${{ env.GITHUB_BRANCH }}"
"DEBIAN=bookworm"
tags: "${{ env.JEEDOM_REPO }}/jeedom:${{ env.JEEDOM_SHORT_VERSION}}-bookworm"
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}