use port 8502 #4
This file contains hidden or 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: Build and Publish Image to DockerHub | |
| on: | |
| pull_request: | |
| branches: [ "master" ] | |
| paths: | |
| - "app/**" | |
| - "Dockerfile" | |
| - ".github/workflows/**" | |
| push: | |
| branches: [ "master" ] | |
| paths: | |
| - "app/**" | |
| - "Dockerfile" | |
| - ".github/workflows/**" | |
| env: | |
| IMAGE_NAME: eohana98/streamlit-ml | |
| jobs: | |
| build-and-push-image: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Create tag | |
| id: new_tag | |
| run: | | |
| tag=$(date +%Y.%m.%d_%H.%M.%S) | |
| echo "TAG=$tag" >> "$GITHUB_OUTPUT" | |
| echo "Created tag: $tag" | |
| - name: Build Image | |
| env: | |
| TAG: ${{ steps.new_tag.outputs.TAG }} | |
| run: | | |
| docker build ./app --file app/Dockerfile \ | |
| --tag $IMAGE_NAME:latest \ | |
| --tag $IMAGE_NAME:$TAG \ | |
| --build-arg VERSION=$TAG | |
| - name: Docker login | |
| if: github.ref_name == 'master' | |
| uses: docker/login-action@v2 | |
| with: | |
| username: eohana98 | |
| password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN}} | |
| - name: Docker push | |
| if: github.ref_name == 'master' | |
| env: | |
| TAG: ${{ steps.new_tag.outputs.TAG }} | |
| run: | | |
| docker push $IMAGE_NAME:$TAG | |
| docker push $IMAGE_NAME:latest |