-
Notifications
You must be signed in to change notification settings - Fork 45
108 lines (95 loc) · 2.84 KB
/
docker_ci.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
name: Docker CI/CD
# Controls when the workflow will run
on:
push:
branches:
- '*'
tags:
- 'v*'
pull_request:
branches:
- '*'
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
# Get the repository's code
- name: Checkout
uses: actions/checkout@v4
# Generate docker tags
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: fiware/wirecloud, quay.io/fiware/wirecloud
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
# Get cache and inject it into docker (https://github.com/reproducible-containers/buildkit-cache-dance)
- name: Cache
uses: actions/cache@v4
id: cache
with:
path: |
var-cache-apt
root-cache-pip
key: cache-${{ hashFiles('Dockerfile') }}
- name: inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3
with:
cache-map: |
{
"var-cache-apt": "/var/cache/apt",
"root-cache-pip": "/root/.cache/pip"
}
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Quay.io
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build amd64 to test
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
tags: fiware/wirecloud:latest
load: true #Load into docker daemon to test
cache-from: type=gha
- name: Setup python to test
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies to test
run: |
sudo pip install sh requests
- name: Run tests
run: |
cd docker-platform
sudo python tests.py
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64, linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max