name: Build Docker image and publish on: [push] env: DOCKER_REPOSITORY: "git.flifloo.fr" jobs: docker: runs-on: docker container: image: docker:cli env: DOCKER_HOST: tcp://dind:2375 services: dind: image: docker:dind cmd: [ "dockerd", "-H", "tcp://0.0.0.0:2375", "--tls=false" ] steps: - name: "Setup env" id: env run: | echo "DOCKER_TAG=$DOCKER_REPOSITORY/$(echo "$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]'):latest" >> "$GITHUB_ENV" apk add --no-cache git nodejs - name: "Setup cache" uses: https://code.forgejo.org/actions/cache@ with: path: "${{ env.GITHUB_WORKSPACE }}/.docker_cache" key: "docker" - name: Set up Docker Buildx uses: https://github.com/docker/setup-buildx-action@v3 - name: "Login to Docker repository" uses: https://github.com/docker/login-action@v3 with: registry: "${{ env.DOCKER_REPOSITORY }}" username: "${{ env.GITHUB_ACTOR }}" password: "${{ secrets.PACKAGE_TOKEN }}" - name: "Build and push" uses: https://github.com/docker/build-push-action@v5 with: context: . push: true tags: "${{ env.DOCKER_TAG }}" cache-from: "type=local,dest=${{ env.GITHUB_WORKSPACE }}/.docker_cache" cache-to: "type=local,dest=${{ env.GITHUB_WORKSPACE }}/.docker_cache"