-
Notifications
You must be signed in to change notification settings - Fork 318
160 lines (143 loc) · 5.59 KB
/
docker-image-latest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
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 .github/scripts/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 Debian:Bullseye with 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=bullseye"
"DATABASE=1"
tags: "${{ env.JEEDOM_REPO }}/jeedom:${{ env.JEEDOM_SHORT_VERSION}}-bullseye"
- 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"
"DATABASE=1"
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 as latest, 4.4 and 4.4-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"
"DATABASE=1"
tags: "${{ env.JEEDOM_REPO }}/jeedom:${{ env.JEEDOM_SHORT_VERSION}}-bookworm,${{ env.JEEDOM_TAGS }}"
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}