summaryrefslogtreecommitdiff
path: root/.github/workflows/docker-image.yml
blob: 460a182bfb919dc33477d4b4bc58fd90caf1959c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Docker Image CI

on:
  push:

permissions:
  packages: write

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Login to GitHub Container Registry
      uses: docker/login-action@v3
      with:
        registry: ghcr.io
        username: token
        password: ${{ secrets.GITHUB_TOKEN }}

    - name: Checkout
      uses: actions/checkout@v4
      with:
        submodules: "recursive"

    - name: Build the Docker image
      run: docker build . --label "org.opencontainers.image.source=https://github.com/DelusionalLogic/dht" --file Dockerfile --tag app

    - name: Push the image
      run: |
        docker tag app ghcr.io/delusionallogic/dht:$VERSION
        docker push ghcr.io/delusionallogic/dht:$VERSION
      env:
        VERSION: 1.${{ github.run_number }}${{ github.ref != 'refs/heads/master' && '-NIGHTLY' || '' }}

    - name: Push a latest tag
      if: ${{ github.ref == 'refs/heads/master' }}
      run: |
        docker tag app ghcr.io/delusionallogic/dht:latest
        docker push ghcr.io/delusionallogic/dht:latest