Skip to content

Commit

Permalink
Add Deploy to DockerHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaMuravjov committed May 25, 2024
1 parent 1d2cbdd commit a85909e
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/dockerhub-deploy.yml
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 }} \
.

0 comments on commit a85909e

Please sign in to comment.