Merge branch 'main' of github.com:EcstaticFly/Chatzy #1
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 Push Docker Images | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Extract metadata for versioning | |
| id: meta | |
| run: | | |
| echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT | |
| - name: Build and push Server Image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./server | |
| file: ./server/Dockerfile | |
| push: true | |
| tags: | | |
| suyash310/chatzy-server:latest | |
| suyash310/chatzy-server:dev | |
| suyash310/chatzy-server:${{ steps.meta.outputs.date }}-${{ steps.meta.outputs.sha_short }} | |
| cache-from: type=registry,ref=suyash310/chatzy-server:latest | |
| cache-to: type=inline | |
| - name: Build and push Client Image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./client | |
| file: ./client/Dockerfile | |
| push: true | |
| tags: | | |
| suyash310/chatzy-client:latest | |
| suyash310/chatzy-client:dev | |
| suyash310/chatzy-client:${{ steps.meta.outputs.date }}-${{ steps.meta.outputs.sha_short }} | |
| cache-from: type=registry,ref=suyash310/chatzy-client:latest | |
| cache-to: type=inline |