memos/Dockerfile

39 lines
840 B
Text
Raw Normal View History

2023-09-18 23:23:13 +08:00
# Build frontend dist.
2023-12-15 21:46:11 +08:00
FROM node:20-alpine AS frontend
2023-09-18 23:23:13 +08:00
WORKDIR /frontend-build
COPY . .
2023-09-18 23:23:13 +08:00
WORKDIR /frontend-build/web
2024-02-05 20:42:01 +08:00
RUN corepack enable && pnpm i --frozen-lockfile
2021-12-12 11:43:27 +08:00
RUN pnpm build
2021-12-12 11:43:27 +08:00
# Build backend exec file.
2024-02-08 08:13:42 +08:00
FROM golang:1.22-alpine AS backend
2021-12-12 11:43:27 +08:00
WORKDIR /backend-build
COPY . .
2024-05-01 10:28:32 +08:00
COPY --from=frontend /frontend-build/web/dist /backend-build/server/router/frontend/dist
2021-12-12 11:43:27 +08:00
RUN CGO_ENABLED=0 go build -ldflags='-s -w' -trimpath -o memos ./bin/memos/main.go
2021-12-12 11:43:27 +08:00
# Make workspace with above generated files.
FROM gcr.io/distroless/static-debian12:latest AS monolithic
2021-12-12 11:43:27 +08:00
WORKDIR /usr/local/memos
ENV TZ="UTC"
2021-12-12 11:43:27 +08:00
COPY --from=backend /backend-build/memos /usr/local/memos/
EXPOSE 5230
2022-02-05 13:04:06 +08:00
# Directory to store the data, which can be referenced as the mounting point.
VOLUME /var/opt/memos
2021-12-12 11:43:27 +08:00
ENV MEMOS_MODE="prod"
ENV MEMOS_PORT="5230"
ENTRYPOINT ["./memos"]