docker-pr.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. name: Docker image builds (pull requests)
  2. on:
  3. pull_request:
  4. branches: ["main"]
  5. env:
  6. DOCKER_METADATA_SET_OUTPUT_ENV: "true"
  7. permissions:
  8. contents: read
  9. jobs:
  10. build:
  11. runs-on: ubuntu-24.04
  12. steps:
  13. - name: Checkout code
  14. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  15. with:
  16. fetch-tags: true
  17. fetch-depth: 0
  18. persist-credentials: false
  19. - name: build essential
  20. run: |
  21. sudo apt-get update
  22. sudo apt-get install -y build-essential
  23. - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
  24. with:
  25. node-version: "24.11.0"
  26. - uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
  27. with:
  28. go-version: "1.25.4"
  29. - uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9
  30. - name: Docker meta
  31. id: meta
  32. uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
  33. with:
  34. images: ghcr.io/${{ github.repository }}
  35. - name: Build and push
  36. id: build
  37. run: |
  38. npm ci
  39. npm run container
  40. env:
  41. PULL_REQUEST_ID: ${{ github.event.number }}
  42. DOCKER_REPO: ghcr.io/${{ github.repository }}
  43. SLOG_LEVEL: debug
  44. - run: |
  45. echo "Test this with:"
  46. echo "docker pull ${DOCKER_IMAGE}"
  47. env:
  48. DOCKER_IMAGE: ${{ steps.build.outputs.docker_image }}