Skip to content

Commit

Permalink
ci: docker build speedup (#1691)
Browse files Browse the repository at this point in the history
  • Loading branch information
amitza committed Sep 12, 2024
1 parent 995c684 commit 6ace409
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
7 changes: 6 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ go.work.sum

Dockerfile
docker/docker-compose.*
cmd/**/Dockerfile
cmd/**/Dockerfile

.dockerignore
.gcloudignore

Makefile
4 changes: 3 additions & 1 deletion .github/workflows/lava.yml
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,6 @@ jobs:
contents: write
packages: write
id-token: write
needs: [test-consensus, test-protocol]
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -423,6 +422,9 @@ jobs:
uses: docker/build-push-action@v5
continue-on-error: true
with:
provenance: false
sbom: false
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: cmd/${{ matrix.binary }}/Dockerfile
Expand Down
7 changes: 4 additions & 3 deletions cmd/lavad/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ RUN apk add --no-cache \

WORKDIR /lava

COPY go.mod go.sum ./

ENV GOCACHE=/root/.cache/go-build
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
go mod download
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
go mod download -x

COPY . .

Expand Down
5 changes: 4 additions & 1 deletion cmd/lavad/Dockerfile.Cosmovisor
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ WORKDIR /lava

COPY go.mod go.sum ./

ENV GOCACHE=/root/.cache/go-build
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
go mod download
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
go mod download -x

COPY . .

Expand Down
9 changes: 5 additions & 4 deletions cmd/lavap/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ RUN apk add --no-cache \

WORKDIR /lava

COPY go.mod go.sum ./

ENV GOCACHE=/root/.cache/go-build
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
go mod download

--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
go mod download -x

COPY . .

ARG GIT_VERSION
Expand Down

0 comments on commit 6ace409

Please sign in to comment.