File tree Expand file tree Collapse file tree 1 file changed +68
-0
lines changed
Expand file tree Collapse file tree 1 file changed +68
-0
lines changed Original file line number Diff line number Diff line change 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_token :
13+ description : ' DockerHub Token'
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 : Pull submodules
33+ run : |
34+ git submodule init && git submodule update
35+
36+ - name : Set up Docker Buildx
37+ uses : docker/setup-buildx-action@v3
38+
39+ - name : Set up QEMU
40+ uses : docker/setup-qemu-action@v3
41+
42+ - name : Build Docker image
43+ run : |
44+ docker buildx build --load \
45+ --platform ${{ matrix.platform }} \
46+ -t cfpq/py_algo:tmp \
47+ .
48+
49+ - name : Run tests
50+ run : |
51+ docker run --rm \
52+ cfpq/py_algo:tmp -c "
53+ echo 'System Info:';
54+ uname -a;
55+ pytest test -v -m 'CI'"
56+
57+ - name : Login to DockerHub
58+ uses : docker/login-action@v3
59+ with :
60+ username : ${{ github.event.inputs.docker_username }}
61+ password : ${{ github.event.inputs.docker_token }}
62+
63+ - name : Push Docker image
64+ run : |
65+ docker buildx build --push \
66+ --platform ${{ matrix.platform }} \
67+ -t cfpq/py_algo:${{ github.event.inputs.image_tag }} \
68+ .
You can’t perform that action at this time.
0 commit comments