diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index e295d67..344ab88 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -26,15 +26,6 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Get hash of latest image - run: docker pull golang:alpine && docker inspect --format='{{index .RepoDigests 0}}' golang:alpine > dockerhash.txt - - name: cache docker cache - uses: actions/cache@v2.1.2 - with: - path: ${{ github.workspace }}/cache - key: ${{ runner.os }}-docker-${{ hashFiles('**/go.mod') }}-${{ hashFiles('**/go.sum') }}-${{ hashFiles('**/dockerhash.txt') }} - restore-keys: | - ${{ runner.os }}-docker- - name: Build and push uses: docker/build-push-action@v2 with: @@ -43,5 +34,5 @@ jobs: platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 push: true tags: 1337kavin/ytproxy:latest - cache-from: type=local,src=cache - cache-to: type=local,dest=cache + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile index ad16bf7..25d07c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,8 @@ WORKDIR /app/ COPY . . -RUN go build -ldflags "-s -w" main.go +RUN --mount=type=cache,target=/root/.cache/go-build \ + go build -ldflags "-s -w" main.go FROM alpine:edge