Skip to content

Commit 9d14732

Browse files
authored
chore: release v0.7.0 (#107)
* fix: align docker build with someguy pattern - add docker buildkit syntax directive - use build cache mounts for faster builds - switch from local to gha/registry cache - update checkout action to v5 - add staging branch to docker triggers - fix undefined GOPATH variable warning this speeds up builds and fixes the dockerfile variable warning from github actions run 17690447231 * chore: release v0.7.0
1 parent 03daa02 commit 9d14732

File tree

3 files changed

+24
-28
lines changed

3 files changed

+24
-28
lines changed

.github/workflows/docker.yml

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Create and publish a Docker image
33
on:
44
workflow_dispatch:
55
push:
6-
branches: ['main']
6+
branches: ['main', 'staging']
77
tags: ['v*']
88

99
env:
@@ -18,7 +18,7 @@ jobs:
1818
packages: write
1919
steps:
2020
- name: Checkout repository
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@v5
2222
with:
2323
ref: ${{ github.ref }}
2424

@@ -28,13 +28,6 @@ jobs:
2828
- name: Set up Docker Buildx
2929
uses: docker/setup-buildx-action@v3
3030

31-
- name: Cache Docker layers
32-
uses: actions/cache@v4
33-
with:
34-
path: /tmp/.buildx-cache
35-
key: ${{ runner.os }}-buildx-${{ github.sha }}
36-
restore-keys: |
37-
${{ runner.os }}-buildx-
3831
- name: Log in to the Container registry
3932
uses: docker/login-action@v3
4033
with:
@@ -58,12 +51,9 @@ jobs:
5851
push: true
5952
file: ./Dockerfile
6053
tags: "${{ steps.tags.outputs.value }}"
61-
cache-from: type=local,src=/tmp/.buildx-cache
62-
cache-to: type=local,dest=/tmp/.buildx-cache-new
63-
64-
# https://github.com/docker/build-push-action/issues/252
65-
# https://github.com/moby/buildkit/issues/1896
66-
- name: Move cache to limit growth
67-
run: |
68-
rm -rf /tmp/.buildx-cache
69-
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
54+
cache-from: |
55+
type=gha
56+
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
57+
cache-to: |
58+
type=gha,mode=max
59+
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max

Dockerfile

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
1+
# syntax=docker/dockerfile:1
12
# Builder
23
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.25-bookworm AS builder
34

45
LABEL org.opencontainers.image.source=https://github.com/ipfs/ipfs-check
6+
LABEL org.opencontainers.image.documentation=https://github.com/ipfs/ipfs-check#docker
57
LABEL org.opencontainers.image.description="Check if you can find your content on IPFS"
68
LABEL org.opencontainers.image.licenses=MIT+APACHE_2.0
79

810
ARG TARGETPLATFORM TARGETOS TARGETARCH
911

10-
ENV GOPATH=/go \
11-
SRC_PATH=$GOPATH/src/github.com/ipfs/ipfs-check \
12-
GOPROXY=https://proxy.golang.org
12+
ENV GOPATH=/go
13+
ENV SRC_PATH=$GOPATH/src/github.com/ipfs/ipfs-check
14+
ENV GO111MODULE=on
15+
ENV GOPROXY=https://proxy.golang.org
1316

14-
COPY go.* $SRC_PATH/
17+
COPY go.mod go.sum $SRC_PATH/
1518
WORKDIR $SRC_PATH
16-
RUN go mod download
19+
RUN --mount=type=cache,target=/go/pkg/mod \
20+
go mod download
1721

1822
COPY . $SRC_PATH
19-
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o $GOPATH/bin/ipfs-check
23+
RUN --mount=type=cache,target=/go/pkg/mod \
24+
--mount=type=cache,target=/root/.cache/go-build \
25+
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o $GOPATH/bin/ipfs-check
2026

2127
# Runner
2228
FROM debian:bookworm-slim
@@ -25,9 +31,9 @@ RUN apt-get update && \
2531
apt-get install --no-install-recommends -y tini ca-certificates curl && \
2632
rm -rf /var/lib/apt/lists/*
2733

28-
ENV GOPATH=/go \
29-
SRC_PATH=$GOPATH/src/github.com/ipfs/ipfs-check \
30-
DATA_PATH=/data/ipfs-check
34+
ENV GOPATH=/go
35+
ENV SRC_PATH=$GOPATH/src/github.com/ipfs/ipfs-check
36+
ENV DATA_PATH=/data/ipfs-check
3137

3238
COPY --from=builder $GOPATH/bin/ipfs-check /usr/local/bin/ipfs-check
3339

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "0.6.0"
2+
"version": "0.7.0"
33
}

0 commit comments

Comments
 (0)