Skip to content

Commit 5e2cb77

Browse files
committed
Add Deploy to DockerHub workflow
1 parent 1d2cbdd commit 5e2cb77

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Deploy to DockerHub
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
docker_username:
7+
description: 'DockerHub Username'
8+
required: true
9+
type: string
10+
11+
# TODO ask admins to configure GitHub Secrets
12+
docker_password:
13+
description: 'DockerHub Password'
14+
required: true
15+
type: string
16+
17+
image_tag:
18+
description: 'Docker Image Tag'
19+
required: true
20+
type: string
21+
22+
jobs:
23+
dockerhub-deploy:
24+
runs-on: ubuntu-latest
25+
strategy:
26+
matrix:
27+
platform: [linux/amd64, linux/arm64]
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v1
34+
35+
- name: Build Docker image
36+
run: |
37+
docker buildx build --load \
38+
--platform ${{ matrix.platform }} \
39+
-t cfpq/py_algo:tmp \
40+
.
41+
42+
- name: Run tests
43+
run: |
44+
docker run --rm \
45+
cfpq/py_algo:tmp -c "
46+
echo 'System Info:';
47+
uname -a;
48+
pytest test -v -m 'CI'"
49+
50+
- name: Login to DockerHub
51+
uses: docker/login-action@v1
52+
with:
53+
username: ${{ github.event.inputs.docker_username }}
54+
password: ${{ github.event.inputs.docker_password }}
55+
56+
- name: Push Docker image
57+
run: |
58+
docker buildx build --push \
59+
--platform ${{ matrix.platform }} \
60+
-t cfpq/py_algo:${{ github.event.inputs.image_tag }} \
61+
.

0 commit comments

Comments
 (0)