2023-09-18 18:23:13 +03:00
|
|
|
# Build frontend dist.
|
2023-12-15 16:46:11 +03:00
|
|
|
FROM node:20-alpine AS frontend
|
2023-09-18 18:23:13 +03:00
|
|
|
WORKDIR /frontend-build
|
|
|
|
|
2023-10-07 20:06:18 +03:00
|
|
|
COPY . .
|
2023-09-18 18:23:13 +03:00
|
|
|
|
2023-10-07 20:06:18 +03:00
|
|
|
WORKDIR /frontend-build/web
|
2023-09-17 15:55:05 +03:00
|
|
|
|
2024-02-05 15:42:01 +03:00
|
|
|
RUN corepack enable && pnpm i --frozen-lockfile
|
2021-12-12 06:43:27 +03:00
|
|
|
|
2023-04-15 19:47:40 +03:00
|
|
|
RUN pnpm build
|
2021-12-12 06:43:27 +03:00
|
|
|
|
|
|
|
# Build backend exec file.
|
2024-09-21 12:36:53 +03:00
|
|
|
FROM golang:1.23-alpine AS backend
|
2021-12-12 06:43:27 +03:00
|
|
|
WORKDIR /backend-build
|
|
|
|
|
|
|
|
COPY . .
|
2024-05-01 05:28:32 +03:00
|
|
|
COPY --from=frontend /frontend-build/web/dist /backend-build/server/router/frontend/dist
|
2021-12-12 06:43:27 +03:00
|
|
|
|
2024-09-21 12:33:01 +03:00
|
|
|
RUN CGO_ENABLED=0 go build -o memos ./bin/memos/main.go
|
2021-12-12 06:43:27 +03:00
|
|
|
|
|
|
|
# Make workspace with above generated files.
|
2024-09-21 12:33:01 +03:00
|
|
|
FROM alpine:latest AS monolithic
|
2021-12-12 06:43:27 +03:00
|
|
|
WORKDIR /usr/local/memos
|
|
|
|
|
2024-09-21 12:33:01 +03:00
|
|
|
RUN apk add --no-cache tzdata
|
2023-04-08 12:57:00 +03:00
|
|
|
ENV TZ="UTC"
|
|
|
|
|
2021-12-12 06:43:27 +03:00
|
|
|
COPY --from=backend /backend-build/memos /usr/local/memos/
|
|
|
|
|
2023-03-09 03:33:33 +03:00
|
|
|
EXPOSE 5230
|
|
|
|
|
2022-02-05 08:04:06 +03:00
|
|
|
# Directory to store the data, which can be referenced as the mounting point.
|
2024-09-21 12:33:01 +03:00
|
|
|
RUN mkdir -p /var/opt/memos
|
2023-05-23 13:50:17 +03:00
|
|
|
VOLUME /var/opt/memos
|
2021-12-12 06:43:27 +03:00
|
|
|
|
2023-05-24 15:08:47 +03:00
|
|
|
ENV MEMOS_MODE="prod"
|
|
|
|
ENV MEMOS_PORT="5230"
|
|
|
|
|
|
|
|
ENTRYPOINT ["./memos"]
|