1- # syntax=docker/dockerfile:1
1+ # syntax=docker/dockerfile:1.7
22# ------ Global scope variables ------
33
44# Set of global build arguments.
@@ -24,9 +24,13 @@ FROM go-alpine AS zoekt-builder
2424RUN apk add --no-cache ca-certificates
2525WORKDIR /zoekt
2626COPY vendor/zoekt/go.mod vendor/zoekt/go.sum ./
27- RUN go mod download
27+ RUN --mount=type=cache,id=sourcebot-go-mod-cache,target=/go/pkg/mod \
28+ --mount=type=cache,id=sourcebot-go-build-cache,target=/root/.cache/go-build \
29+ go mod download
2830COPY vendor/zoekt ./
29- RUN CGO_ENABLED=0 GOOS=linux go build -o /cmd/ ./cmd/...
31+ RUN --mount=type=cache,id=sourcebot-go-mod-cache,target=/go/pkg/mod \
32+ --mount=type=cache,id=sourcebot-go-build-cache,target=/root/.cache/go-build \
33+ CGO_ENABLED=0 GOOS=linux go build -o /cmd/ ./cmd/...
3034# -------------------------
3135
3236# ------ Build shared libraries ------
@@ -40,10 +44,14 @@ COPY ./packages/schemas ./packages/schemas
4044COPY ./packages/shared ./packages/shared
4145COPY ./packages/queryLanguage ./packages/queryLanguage
4246
43- RUN yarn workspace @sourcebot/db install
44- RUN yarn workspace @sourcebot/schemas install
45- RUN yarn workspace @sourcebot/shared install
46- RUN yarn workspace @sourcebot/query-language install
47+ RUN --mount=type=cache,id=sourcebot-yarn-cache,target=/app/.yarn/cache \
48+ yarn workspace @sourcebot/db install
49+ RUN --mount=type=cache,id=sourcebot-yarn-cache,target=/app/.yarn/cache \
50+ yarn workspace @sourcebot/schemas install
51+ RUN --mount=type=cache,id=sourcebot-yarn-cache,target=/app/.yarn/cache \
52+ yarn workspace @sourcebot/shared install
53+ RUN --mount=type=cache,id=sourcebot-yarn-cache,target=/app/.yarn/cache \
54+ yarn workspace @sourcebot/query-language install
4755# ------------------------------------
4856
4957# ------ Build Web ------
@@ -89,7 +97,8 @@ COPY --from=shared-libs-builder /app/packages/shared ./packages/shared
8997COPY --from=shared-libs-builder /app/packages/queryLanguage ./packages/queryLanguage
9098
9199# Fixes arm64 timeouts
92- RUN yarn workspace @sourcebot/web install
100+ RUN --mount=type=cache,id=sourcebot-yarn-cache,target=/app/.yarn/cache \
101+ yarn workspace @sourcebot/web install
93102
94103ENV NEXT_TELEMETRY_DISABLED=1
95104RUN yarn workspace @sourcebot/web build
@@ -126,7 +135,8 @@ COPY --from=shared-libs-builder /app/packages/db ./packages/db
126135COPY --from=shared-libs-builder /app/packages/schemas ./packages/schemas
127136COPY --from=shared-libs-builder /app/packages/shared ./packages/shared
128137COPY --from=shared-libs-builder /app/packages/queryLanguage ./packages/queryLanguage
129- RUN yarn workspace @sourcebot/backend install
138+ RUN --mount=type=cache,id=sourcebot-yarn-cache,target=/app/.yarn/cache \
139+ yarn workspace @sourcebot/backend install
130140RUN yarn workspace @sourcebot/backend build
131141
132142# Upload source maps to Sentry if we have the necessary build-time args.
0 commit comments