publish-dragonos-docker-image.yml 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. name: Publish Docker images
  2. on:
  3. workflow_dispatch:
  4. push:
  5. paths:
  6. - tools/BUILD_CONTAINER_VERSION
  7. branches:
  8. - master
  9. jobs:
  10. docker:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Set up Docker Buildx
  14. uses: docker/setup-buildx-action@v2
  15. - name: Login to Docker Hub
  16. uses: docker/login-action@v2
  17. with:
  18. username: ${{ secrets.DOCKERHUB_USERNAME }}
  19. password: ${{ secrets.DOCKERHUB_TOKEN }}
  20. - uses: actions/checkout@v4
  21. - name: Fetch versions in the repo
  22. id: fetch-versions
  23. run: |
  24. BUILD_CONTAINER_VERSION=$(cat tools/BUILD_CONTAINER_VERSION)
  25. echo "build_container_version=$BUILD_CONTAINER_VERSION" >> "$GITHUB_OUTPUT"
  26. - name: Build and push docker image
  27. uses: docker/build-push-action@v4
  28. with:
  29. context: "{{defaultContext}}:tools"
  30. file: Dockerfile
  31. platforms: linux/amd64
  32. push: true
  33. tags: dragonos/dragonos-dev:${{ steps.fetch-versions.outputs.build_container_version }}