-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d2cbdd
commit a85909e
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Deploy to DockerHub | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
docker_username: | ||
description: 'DockerHub Username' | ||
required: true | ||
type: string | ||
|
||
# TODO ask admins to configure GitHub Secrets | ||
docker_password: | ||
description: 'DockerHub Password' | ||
required: true | ||
type: string | ||
|
||
image_tag: | ||
description: 'Docker Image Tag' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
dockerhub-deploy: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
platform: [linux/amd64, linux/arm64] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build Docker image | ||
run: | | ||
docker buildx build --load \ | ||
--platform ${{ matrix.platform }} \ | ||
-t cfpq/py_algo:${{ github.event.inputs.image_tag }}-${{ matrix.platform }} \ | ||
. | ||
- name: Run tests | ||
run: | | ||
docker run --rm \ | ||
cfpq/py_algo:${{ github.event.inputs.image_tag }}-${{ matrix.platform }} bash -c " | ||
echo 'System Info:'; | ||
uname -a; | ||
pytest test -v -m 'CI'" | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ github.event.inputs.docker_username }} | ||
password: ${{ github.event.inputs.docker_password }} | ||
|
||
- name: Push Docker image | ||
run: | | ||
docker buildx build --push \ | ||
--platform ${{ matrix.platform }} \ | ||
-t cfpq/py_algo:${{ github.event.inputs.image_tag }} \ | ||
. |