changed access to dockerhub #2
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: Docker Image CI | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| jobs: | |
| build: | |
| name: Create image and push to registry | |
| runs-on: ubuntu-22.04 | |
| environment: development | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ vars.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build the Docker image | |
| run: export VERSION=$(jq -r .version package.json) && docker build . --file Dockerfile --tag ${{ vars.DOCKERHUB_USERNAME }}/node-app:$VERSION.$GITHUB_RUN_ID | |
| - name: Push to Docker Hub | |
| run: export VERSION=$(jq -r .version package.json) && docker push ${{ vars.DOCKERHUB_USERNAME }}/node-app:$VERSION.$GITHUB_RUN_ID |