Skip to content

Commit

Permalink
chore: add caching to Linux docker run (#123)
Browse files Browse the repository at this point in the history
Add cache mount directives to Linux docker container so that reruns
are much quicker.

Co-authored-by: Manuel de la Peña <[email protected]>
  • Loading branch information
stevenh and mdelapenya authored Oct 9, 2024
1 parent 9280853 commit d0c3b50
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@
# -----------
FROM golang:1.23-alpine3.19 AS build

WORKDIR /app

# Go build env
ENV CGO_ENABLED=0

WORKDIR /app

# Install source deps
COPY go.mod go.sum ./
RUN go mod download
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download

# Copy source & build
COPY . .
RUN go build -v -ldflags '-s' -o /bin/ryuk
RUN chmod +x /bin/ryuk
COPY --link . .

RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go build -ldflags '-s' -o /bin/ryuk

# -----------------
# Distributed Image
Expand Down

0 comments on commit d0c3b50

Please sign in to comment.