name: "Docker build" description: "Builds a docker image" inputs: name: description: "Directory name" required: true REGISTRY_USERNAME: description: "Registry username" required: true REGISTRY_TOKEN: description: "Registry token" required: true DOCKER_USERNAME: description: "Docker username" required: true DOCKER_PASSWORD: description: "Docker password" required: true runs: using: "composite" steps: - name: Checkout uses: https://git.kjan.de/actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Set up Docker Buildx uses: https://git.kjan.de/actions/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3 - name: Login to local Docker Registry uses: https://git.kjan.de/actions/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 with: registry: git.kjan.de username: ${{ inputs.REGISTRY_USERNAME }} password: ${{ inputs.REGISTRY_TOKEN }} - name: Login to Docker.io Registry uses: https://git.kjan.de/actions/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 with: username: ${{ inputs.DOCKER_USERNAME }} password: ${{ inputs.DOCKER_PASSWORD }} - name: Cache Docker layers uses: actions/cache@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # v4 with: path: /tmp/.buildx-cache key: ${{ runner.os }}-${{ inputs.name }}-${{ github.sha }} restore-keys: | ${{ runner.os }}-${{ inputs.name }}- - name: Build and push uses: https://git.kjan.de/actions/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6 with: cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max context: ./images/actions/${{ inputs.name }} push: ${{ github.ref == 'refs/heads/main' }} tags: | git.kjan.de/actions/${{ inputs.name }}:latest git.kjan.de/actions/${{ inputs.name }}:${{ gitea.sha }} - # Temp fix # https://github.com/docker/build-push-action/issues/252 # https://github.com/moby/buildkit/issues/1896 name: Move cache run: | rm -rf /tmp/.buildx-cache mv /tmp/.buildx-cache-new /tmp/.buildx-cache