Skip to content
This repository was archived by the owner on Feb 9, 2024. It is now read-only.

Commit a9fc102

Browse files
authored
Make: Add GH actions to build docker image (#23)
1 parent 6d6ff83 commit a9fc102

File tree

3 files changed

+131
-0
lines changed

3 files changed

+131
-0
lines changed

.github/workflows/docker-edge.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: docker-builder-edge
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: true
13+
matrix:
14+
python_version:
15+
- 3.8
16+
- 3.6
17+
- 3.9
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
- name: Docker meta for EDGE
23+
id: meta
24+
uses: docker/metadata-action@v3
25+
if: startsWith(github.ref, 'refs/heads/master')
26+
with:
27+
images: ${{ secrets.DOCKER_IMAGE }}
28+
tags: |
29+
type=edge,prefix=${{matrix.python_version}}-
30+
31+
- name: Login to DockerHub
32+
uses: docker/login-action@v1
33+
with:
34+
username: ${{ secrets.DOCKERHUB_USERNAME }}
35+
password: ${{ secrets.DOCKER_PASSWORD }}
36+
37+
- name: Build and push
38+
uses: docker/build-push-action@v2
39+
with:
40+
context: .
41+
file: ${{ matrix.python_version }}/Dockerfile
42+
push: true
43+
tags: ${{ steps.meta.outputs.tags }}
44+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/docker-pr.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: docker-builder-pull-requests
3+
on:
4+
pull_request_target:
5+
branches:
6+
- 'master'
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: true
13+
matrix:
14+
python_version:
15+
- 3.8
16+
- 3.6
17+
- 3.9
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
- name: Docker meta for PR
23+
id: meta
24+
uses: docker/metadata-action@v3
25+
if: github.event_name == 'pull_request'
26+
with:
27+
images: ${{ secrets.DOCKER_IMAGE }}
28+
tags: |
29+
type=ref,enable=true,priority=600,prefix=${{matrix.python_version}}-pr-,suffix=,event=pr
30+
31+
- name: Login to DockerHub
32+
uses: docker/login-action@v1
33+
with:
34+
username: ${{ secrets.DOCKERHUB_USERNAME }}
35+
password: ${{ secrets.DOCKER_PASSWORD }}
36+
37+
- name: Build and push
38+
uses: docker/build-push-action@v2
39+
with:
40+
context: .
41+
file: ${{ matrix.python_version }}/Dockerfile
42+
push: true
43+
tags: ${{ steps.meta.outputs.tags }}
44+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/docker-stable.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: docker-builder-tags
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: true
13+
matrix:
14+
python_version:
15+
- 3.8
16+
- 3.6
17+
- 3.9
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
- name: Docker meta for TAG
23+
id: meta
24+
uses: docker/metadata-action@v3
25+
with:
26+
images: ${{ secrets.DOCKER_IMAGE }}
27+
tags: |
28+
type=match,pattern=v(.*),group=1, enable=true,priority=600,prefix=${{matrix.python_version}}-v,suffix=,value=
29+
30+
- name: Login to DockerHub
31+
uses: docker/login-action@v1
32+
with:
33+
username: ${{ secrets.DOCKERHUB_USERNAME }}
34+
password: ${{ secrets.DOCKER_PASSWORD }}
35+
36+
- name: Build and push
37+
uses: docker/build-push-action@v2
38+
with:
39+
context: .
40+
file: ${{ matrix.python_version }}/Dockerfile
41+
push: true
42+
tags: ${{ steps.meta.outputs.tags }}
43+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)