@@ -11,13 +11,19 @@ name: docker
11
11
on :
12
12
# run it on push to the default repository branch
13
13
push :
14
+ paths-ignore :
15
+ - ' docs/**'
16
+ tags-ignore :
17
+ - ' **'
18
+ # branches is needed if tags-ignore is used
19
+ branches :
20
+ - ' **'
14
21
schedule :
15
22
# Run weekly on default branch
16
23
- cron : ' 47 3 * * 6'
17
24
18
25
jobs :
19
- # define job to build and publish docker image
20
- build-and-push-docker-image :
26
+ build-and-push-docker-debian-image :
21
27
name : Build Docker image and push to repositories
22
28
# run only when code is compiling and tests are passing
23
29
runs-on : ubuntu-latest
@@ -57,40 +63,94 @@ jobs:
57
63
username : ${{ github.actor }}
58
64
password : ${{ secrets.GHCR_IO_TOKEN }}
59
65
60
- - name : " no_qr_reader : Build image and push to Docker Hub and GitHub Container Registry"
61
- id : docker_build_only_txt
62
- uses : docker/build-push-action@v2
66
+ - name : " qr_reader : Build image and push to Docker Hub and GitHub Container Registry"
67
+ id : docker_build_qr_reader_latest
68
+ uses : docker/build-push-action@v3
63
69
with :
64
- # relative path to the place where source code with Dockerfile is located
65
70
platforms : linux/amd64,linux/arm64
71
+ # relative path to the place where source code with Dockerfile is located
72
+ # TODO file:, move to docker/
66
73
context : .
67
- file : Dockerfile_only_txt
74
+ file : Dockerfile
68
75
# builder: ${{ steps.buildx.outputs.name }}
69
76
# Note: tags has to be all lower-case
77
+ pull : true
70
78
tags : |
71
- scit0/extract_otp_secrets:latest-only-txt
72
- ghcr.io/scito/extract_otp_secrets:latest-only-txt
79
+ scit0/extract_otp_secrets:latest
80
+ scit0/extract_otp_secrets:bullseye
81
+ ghcr.io/scito/extract_otp_secrets:latest
82
+ ghcr.io/scito/extract_otp_secrets:bullseye
73
83
# build on feature branches, push only on master branch
74
84
push : ${{ github.ref == 'refs/heads/master' }}
75
- build-args : |
76
- RUN_TESTS=true
77
85
78
- - name : " qr_reader: Build image and push to Docker Hub and GitHub Container Registry"
79
- id : docker_build_qr_reader
80
- uses : docker/build-push-action@v2
86
+ - name : Image digest
87
+ # TODO upload digests to assets
88
+ run : |
89
+ echo "extract_otp_secrets: ${{ steps.docker_build_qr_reader_latest.outputs.digest }}"
90
+
91
+ build-and-push-docker-alpine-image :
92
+ name : Build Docker image and push to repositories
93
+ # run only when code is compiling and tests are passing
94
+ runs-on : ubuntu-latest
95
+
96
+ # steps to perform in job
97
+ steps :
98
+ - name : Checkout code
99
+ uses : actions/checkout@v3
100
+
101
+ # avoid building if there are testing errors
102
+ - name : Run smoke test
103
+ run : |
104
+ sudo apt-get install -y libzbar0
105
+ python -m pip install --upgrade pip
106
+ pip install -U -r requirements-dev.txt
107
+ pip install -U .
108
+ pytest
109
+
110
+ - name : Set up QEMU
111
+ uses : docker/setup-qemu-action@v2
112
+
113
+ # setup Docker build action
114
+ - name : Set up Docker Buildx
115
+ id : buildx
116
+ uses : docker/setup-buildx-action@v2
117
+
118
+ - name : Login to DockerHub
119
+ uses : docker/login-action@v2
120
+ with :
121
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
122
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
123
+
124
+ - name : Login to Github Packages
125
+ uses : docker/login-action@v2
126
+ with :
127
+ registry : ghcr.io
128
+ username : ${{ github.actor }}
129
+ password : ${{ secrets.GHCR_IO_TOKEN }}
130
+
131
+ - name : " only_txt: Build image and push to Docker Hub and GitHub Container Registry"
132
+ id : docker_build_only_txt
133
+ uses : docker/build-push-action@v3
81
134
with :
82
- platforms : linux/amd64,linux/arm64
83
135
# relative path to the place where source code with Dockerfile is located
136
+ platforms : linux/amd64,linux/arm64
84
137
context : .
138
+ file : Dockerfile_only_txt
85
139
# builder: ${{ steps.buildx.outputs.name }}
86
140
# Note: tags has to be all lower-case
141
+ pull : true
87
142
tags : |
88
- scit0/extract_otp_secrets:latest
89
- ghcr.io/scito/extract_otp_secrets:latest
143
+ scit0/extract_otp_secrets:only-txt
144
+ scit0/extract_otp_secrets:alpine
145
+ ghcr.io/scito/extract_otp_secrets:only-txt
146
+ ghcr.io/scito/extract_otp_secrets:alpine
90
147
# build on feature branches, push only on master branch
91
148
push : ${{ github.ref == 'refs/heads/master' }}
149
+ build-args : |
150
+ RUN_TESTS=true
151
+
92
152
93
153
- name : Image digest
154
+ # TODO upload digests to assets
94
155
run : |
95
- echo "extract_otp_secrets: ${{ steps.docker_build_qr_reader.outputs.digest }}"
96
- echo "extract_otp_secrets_only_txt: ${{ steps.docker_build_only_txt.outputs.digest }}"
156
+ echo "extract_otp_secrets:only-txt: ${{ steps.docker_build_only_txt.outputs.digest }}"
0 commit comments