|
| 1 | +name: Push to Docker Hub |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - name: Remove unnecessary packages |
| 11 | + run: | |
| 12 | + echo "=== Before pruning ===" |
| 13 | + df -h |
| 14 | + sudo rm -rf /usr/share/dotnet |
| 15 | + sudo rm -rf /usr/local/lib/android |
| 16 | + sudo rm -rf /opt/ghc |
| 17 | + echo "=== After pruning ===" |
| 18 | + df -h |
| 19 | +
|
| 20 | + # Link to discussion: https://github.com/orgs/community/discussions/25678 |
| 21 | + |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v3 |
| 24 | + with: |
| 25 | + submodules: true |
| 26 | + |
| 27 | + - name: Docker meta |
| 28 | + id: meta |
| 29 | + uses: crazy-max/ghaction-docker-meta@v2 |
| 30 | + with: |
| 31 | + images: | |
| 32 | + primeintellect/open_diloco |
| 33 | + tags: | |
| 34 | + type=ref,event=branch |
| 35 | + type=ref,event=pr |
| 36 | + type=semver,pattern={{version}} |
| 37 | + type=semver,pattern={{major}}.{{minor}} |
| 38 | + type=semver,pattern={{major}} |
| 39 | + type=sha,prefix=commit- |
| 40 | +
|
| 41 | + - name: Set up Docker Buildx |
| 42 | + id: buildx |
| 43 | + uses: docker/setup-buildx-action@v1 |
| 44 | + |
| 45 | + - name: Login to Docker Hub |
| 46 | + if: github.event_name != 'pull_request' |
| 47 | + uses: docker/login-action@v1 |
| 48 | + with: |
| 49 | + username: ${{ secrets.DOCKER_HUB_USERNAME }} |
| 50 | + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} |
| 51 | + |
| 52 | + - name: Build and push |
| 53 | + id: docker_build |
| 54 | + uses: docker/build-push-action@v2 |
| 55 | + with: |
| 56 | + context: . |
| 57 | + push: ${{ github.event_name != 'pull_request' }} |
| 58 | + tags: ${{ steps.meta.outputs.tags }} |
| 59 | + |
| 60 | + - name: Image digest |
| 61 | + run: echo ${{ steps.docker_build.outputs.digest }} |
0 commit comments