feature/use-buildkit (#11)
Reviewed-on: #11
This commit was merged in pull request #11.
	This commit is contained in:
		
							
								
								
									
										87
									
								
								.gitea/workflows/build.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								.gitea/workflows/build.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,87 @@
 | 
			
		||||
name: Docker Build Workflow
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  dockerfile_lint:
 | 
			
		||||
    name: Lint Dockerfile
 | 
			
		||||
    runs-on: ubuntu-22.04
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v4
 | 
			
		||||
      - uses: hadolint/hadolint-action@v3.1.0
 | 
			
		||||
        with:
 | 
			
		||||
          dockerfile: Dockerfile
 | 
			
		||||
 | 
			
		||||
  build:
 | 
			
		||||
    name: Build and Push Docker Image
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    container:
 | 
			
		||||
      image: docker:dind
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Set up nodejs
 | 
			
		||||
        id: nodejs
 | 
			
		||||
        shell: sh
 | 
			
		||||
        run: |
 | 
			
		||||
          apk add nodejs
 | 
			
		||||
 | 
			
		||||
      - name: Checkout repository
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
 | 
			
		||||
      - name: Set Docker Build Tag
 | 
			
		||||
        id: set_tag
 | 
			
		||||
        run: |
 | 
			
		||||
          # Default Docker tag
 | 
			
		||||
          DOCKER_TAG="latest"
 | 
			
		||||
 | 
			
		||||
          # If this is a Git tag, use it
 | 
			
		||||
          if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
 | 
			
		||||
            DOCKER_TAG="${GITHUB_REF#refs/tags/}"
 | 
			
		||||
          fi
 | 
			
		||||
 | 
			
		||||
          echo "GIT_TAG=$DOCKER_TAG" >> $GITHUB_ENV
 | 
			
		||||
 | 
			
		||||
      - name: Set up Docker Context for Buildx
 | 
			
		||||
        id: buildx-context
 | 
			
		||||
        shell: sh
 | 
			
		||||
        run: |
 | 
			
		||||
          docker context use builders || docker context create builders
 | 
			
		||||
          apk add nodejs
 | 
			
		||||
 | 
			
		||||
      - name: Set up Docker Buildx
 | 
			
		||||
        uses: docker/setup-buildx-action@v3
 | 
			
		||||
        with:
 | 
			
		||||
          version: latest
 | 
			
		||||
          endpoint: builders
 | 
			
		||||
 | 
			
		||||
      - name: Login to gitea.sikorski.cloud
 | 
			
		||||
        uses: docker/login-action@v3
 | 
			
		||||
        with:
 | 
			
		||||
          registry: gitea.sikorski.cloud
 | 
			
		||||
          username: rogersik
 | 
			
		||||
          password: ${{ secrets.REGISTRY_PASSWORD }}
 | 
			
		||||
 | 
			
		||||
      - name: Docker Meta
 | 
			
		||||
        id: meta
 | 
			
		||||
        uses: docker/metadata-action@v5
 | 
			
		||||
        with:
 | 
			
		||||
          images: ${{ secrets.REGISTRY_URL }}
 | 
			
		||||
          flavor: |
 | 
			
		||||
            latest=false
 | 
			
		||||
          tags: |
 | 
			
		||||
            type=sha,prefix=,format=short
 | 
			
		||||
            type=ref,event=tag
 | 
			
		||||
 | 
			
		||||
      - name: Build and Push Docker Image
 | 
			
		||||
        uses: docker/build-push-action@v6
 | 
			
		||||
        env:
 | 
			
		||||
          ACTIONS_RUNTIME_TOKEN: ''
 | 
			
		||||
        with:
 | 
			
		||||
          pull: true
 | 
			
		||||
          push: true
 | 
			
		||||
          labels: ${{ steps.meta.outputs.labels }}
 | 
			
		||||
          provenance: false
 | 
			
		||||
          tags: gitea.sikorski.cloud/rogersik/monica:${{ env.GIT_TAG }}
 | 
			
		||||
          build-args: |
 | 
			
		||||
            GIT_TAG=${{ env.GIT_TAG }}
 | 
			
		||||
@@ -1,35 +0,0 @@
 | 
			
		||||
name: docker-monica-build development
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    branches-ignore:
 | 
			
		||||
      - main # Läuft auf allen Branches außer `main`
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  dockerfile_lint:
 | 
			
		||||
    runs-on: ubuntu-22.04
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v4
 | 
			
		||||
      - uses: hadolint/hadolint-action@v3.1.0
 | 
			
		||||
        with:
 | 
			
		||||
          dockerfile: Dockerfile
 | 
			
		||||
 | 
			
		||||
  build:
 | 
			
		||||
    needs: dockerfile_lint
 | 
			
		||||
    runs-on: ubuntu-22.04
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v4
 | 
			
		||||
      - name: Clean Branch Name
 | 
			
		||||
        id: clean_branch_name
 | 
			
		||||
        run: |
 | 
			
		||||
          CLEANED_BRANCH_NAME=$(echo "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]' | tr '/_' '-')
 | 
			
		||||
          echo "CLEAN_BRANCH_NAME=${CLEANED_BRANCH_NAME}" >> $GITHUB_ENV
 | 
			
		||||
      - name: Kaniko build
 | 
			
		||||
        uses: aevea/action-kaniko@v0.12.0
 | 
			
		||||
        with:
 | 
			
		||||
          image: rogersik/monica
 | 
			
		||||
          registry: gitea.sikorski.cloud
 | 
			
		||||
          tag: "${{ env.CLEAN_BRANCH_NAME }}"
 | 
			
		||||
          cache: true
 | 
			
		||||
          username: rogersik
 | 
			
		||||
          password: ${{ secrets.REGISTRY_PASSWORD }}
 | 
			
		||||
@@ -1,34 +0,0 @@
 | 
			
		||||
name: docker-monica-build main
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    tags:
 | 
			
		||||
      - '[0-9]+.*'
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  dockerfile_lint:
 | 
			
		||||
    runs-on: ubuntu-22.04
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v4
 | 
			
		||||
      - uses: hadolint/hadolint-action@v3.1.0
 | 
			
		||||
        with:
 | 
			
		||||
          dockerfile: Dockerfile
 | 
			
		||||
 | 
			
		||||
  build:
 | 
			
		||||
    needs: dockerfile_lint
 | 
			
		||||
    runs-on: ubuntu-22.04
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v4
 | 
			
		||||
      - name: Extract Git Tag
 | 
			
		||||
        id: get_tag
 | 
			
		||||
        run: echo "TAG=${GITHUB_REF_NAME}" >> $GITHUB_ENV
 | 
			
		||||
      - name: Kaniko build
 | 
			
		||||
        uses: aevea/action-kaniko@v0.12.0
 | 
			
		||||
        with:
 | 
			
		||||
          image: rogersik/monica
 | 
			
		||||
          registry: gitea.sikorski.cloud
 | 
			
		||||
          tag: '${{ env.TAG }}'
 | 
			
		||||
          cache: true
 | 
			
		||||
          build_args: |
 | 
			
		||||
            GIT_TAG=${{ env.TAG }}
 | 
			
		||||
          username: rogersik
 | 
			
		||||
          password: ${{ secrets.REGISTRY_PASSWORD }}
 | 
			
		||||
		Reference in New Issue
	
	Block a user