image.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # This workflow will build a Java project with Maven
  2. # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
  3. name: PIG 镜像 action
  4. on:
  5. push:
  6. branches: [ master ]
  7. jobs:
  8. task:
  9. runs-on: ${{ matrix.os }}
  10. strategy:
  11. matrix:
  12. os: [ubuntu-latest]
  13. node-version: [18.x]
  14. npm-client: [npm]
  15. steps:
  16. - uses: pnpm/action-setup@v2
  17. if: matrix.npm-client == 'pnpm'
  18. name: Install pnpm
  19. with:
  20. version: 7
  21. run_install: false
  22. - name: Set up Node.js ${{ matrix.node-version }}
  23. uses: actions/setup-node@v4
  24. with:
  25. node-version: ${{ matrix.node-version }}
  26. - name: Check out code
  27. uses: actions/checkout@v4
  28. - name: Install dependencies
  29. run: ${{ matrix.npm-client }} install
  30. - name: Build
  31. run: ${{ matrix.npm-client }} run build:docker
  32. - name: Login to Docker Registry
  33. run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} registry.cn-hangzhou.aliyuncs.com
  34. - name: Build and push Docker images
  35. run: |
  36. docker-compose -f ./docker/docker-compose.yaml build
  37. registry="registry.cn-hangzhou.aliyuncs.com/lttcaix/"
  38. for service in $(docker-compose -f ./docker/docker-compose.yaml config --services); do
  39. docker tag ${service}:latest ${registry}${service}:latest
  40. docker push ${registry}${service}:latest
  41. done