1
0

build-image.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. name: ProxyPanel Docker
  2. on:
  3. push:
  4. branches:
  5. # - master
  6. tags:
  7. - V*
  8. jobs:
  9. build:
  10. name: Build ProxyPanel Docker Image
  11. runs-on: ubuntu-18.04
  12. steps:
  13. - name: Git Checkout Code
  14. uses: actions/checkout@v1
  15. id: git_checkout
  16. - name: Prepare
  17. id: prep
  18. run: |
  19. DOCKER_IMAGE=${{ secrets.DOCKER_REPO }}
  20. VERSION=edge
  21. if [[ $GITHUB_REF == refs/tags/* ]]; then
  22. VERSION=${GITHUB_REF#refs/tags/}
  23. elif [[ $GITHUB_REF == refs/heads/* ]]; then
  24. VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
  25. elif [[ $GITHUB_REF == refs/pull/* ]]; then
  26. VERSION=pr-${{ github.event.number }}
  27. fi
  28. echo ::set-output name=version::${VERSION}
  29. echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
  30. - name: Set up Docker Buildx
  31. uses: docker/setup-buildx-action@v1
  32. - name: Login to DockerHub
  33. uses: docker/login-action@v1
  34. with:
  35. username: ${{ secrets.DOCKER_USERNAME }}
  36. password: ${{ secrets.DOCKER_PASSWORD }}
  37. - name: Build and push
  38. uses: docker/build-push-action@v2
  39. with:
  40. context: .
  41. file: ./Dockerfile
  42. tags: latest
  43. labels: |
  44. org.opencontainers.image.source=${{ github.event.repository.html_url }}
  45. org.opencontainers.image.created=${{ steps.prep.outputs.created }}
  46. org.opencontainers.image.revision=${{ github.sha }}