From e41916408a3523b9ac1acb145cbd95c90f765483 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 21 Apr 2025 22:26:18 +0800 Subject: [PATCH] chore: update dockerfile --- scripts/Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/Dockerfile b/scripts/Dockerfile index ccb21bcd6..0a884a144 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -1,11 +1,13 @@ FROM golang:1.24-alpine AS backend WORKDIR /backend-build - +COPY go.mod go.sum ./ +RUN go mod download COPY . . # Please build frontend first, so that the static files are available. # Refer to `pnpm release` in package.json for the build command. - -RUN go build -o memos ./bin/memos/main.go +RUN --mount=type=cache,target=/go/pkg/mod \ + --mount=type=cache,target=/root/.cache/go-build \ + go build -ldflags="-s -w" -o memos ./bin/memos/main.go # Make workspace with above generated files. FROM alpine:latest AS monolithic