Add Dockerfile and download_model.py for model deployment #42
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
name: workflow | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "README.md" | |
permissions: | |
contents: read | |
jobs: | |
integration: | |
name: Continuous Integration | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Lint code | |
run: echo "Linting repository" | |
- name: Run unit tests | |
run: echo "Running unit tests" | |
build-and-push-dockerhub-image: | |
name: Continuous Delivery | |
needs: integration | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Install Utilities | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y jq unzip | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} | |
- name: Build, tag, and push image to Docker Hub | |
id: build-image | |
env: | |
DOCKERHUB_REPOSITORY: ${{ secrets.DOCKERHUB_REPOSITORY }} | |
IMAGE_TAG: latest | |
run: | | |
docker build -t $DOCKERHUB_REPOSITORY:$IMAGE_TAG . | |
docker push $DOCKERHUB_REPOSITORY:$IMAGE_TAG | |
echo "::set-output name=image::$DOCKERHUB_REPOSITORY:$IMAGE_TAG" | |
sync-to-hub: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Sync to Hugging Face Spaces | |
uses: JacobLinCool/huggingface-sync@v1 | |
with: | |
github: ${{ secrets.GITHUB_TOKEN }} | |
user: ${{ vars.HF_SPACE_OWNER }} | |
space: ${{ vars.HF_SPACE_NAME }} | |
token: ${{ secrets.HF_TOKEN }} | |
configuration: "README.md.yml" |