docker-dev.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. name: Build Dev Docker Image
  2. on:
  3. workflow_dispatch:
  4. env:
  5. REGISTRY: ghcr.io
  6. IMAGE_NAME: ${{ github.repository }}
  7. jobs:
  8. build-and-push:
  9. runs-on: ubuntu-latest
  10. permissions:
  11. contents: read
  12. packages: write
  13. steps:
  14. - name: Checkout repository
  15. uses: actions/checkout@v4
  16. - name: Set up Docker Buildx
  17. uses: docker/setup-buildx-action@v3
  18. - name: Log in to GitHub Container Registry
  19. uses: docker/login-action@v3
  20. with:
  21. registry: ${{ env.REGISTRY }}
  22. username: ${{ github.actor }}
  23. password: ${{ secrets.GITHUB_TOKEN }}
  24. - name: Get short commit SHA
  25. id: sha
  26. run: echo "short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
  27. - name: Extract metadata (tags, labels)
  28. id: meta
  29. uses: docker/metadata-action@v5
  30. with:
  31. images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  32. tags: |
  33. type=raw,value=dev-${{ steps.sha.outputs.short }}
  34. - name: Build and push Docker image
  35. uses: docker/build-push-action@v6
  36. with:
  37. context: .
  38. push: true
  39. tags: ${{ steps.meta.outputs.tags }}
  40. labels: ${{ steps.meta.outputs.labels }}
  41. build-args: |
  42. APP_VERSION=dev-${{ steps.sha.outputs.short }}
  43. cache-from: type=gha
  44. cache-to: type=gha,mode=max