2021-12-12 11:43:27 +08:00
|
|
|
# Build frontend dist.
|
2022-11-19 14:51:28 +08:00
|
|
|
FROM node:18.12.1-alpine3.16 AS frontend
|
2021-12-12 11:43:27 +08:00
|
|
|
WORKDIR /frontend-build
|
|
|
|
|
2023-04-16 00:47:40 +08:00
|
|
|
COPY ./web/package.json ./web/pnpm-lock.yaml ./
|
2023-03-18 10:36:53 +08:00
|
|
|
|
2023-04-16 00:47:40 +08:00
|
|
|
RUN npm install -g pnpm && pnpm i --frozen-lockfile
|
2023-03-18 10:36:53 +08:00
|
|
|
|
2021-12-12 11:43:27 +08:00
|
|
|
COPY ./web/ .
|
|
|
|
|
2023-04-16 00:47:40 +08:00
|
|
|
RUN pnpm build
|
2021-12-12 11:43:27 +08:00
|
|
|
|
|
|
|
# Build backend exec file.
|
2022-11-19 14:51:28 +08:00
|
|
|
FROM golang:1.19.3-alpine3.16 AS backend
|
2021-12-12 11:43:27 +08:00
|
|
|
WORKDIR /backend-build
|
|
|
|
|
2023-01-14 08:00:07 +08:00
|
|
|
RUN apk update && apk add --no-cache gcc musl-dev
|
2022-07-03 22:45:10 +08:00
|
|
|
|
2021-12-12 11:43:27 +08:00
|
|
|
COPY . .
|
2022-07-10 09:02:56 +08:00
|
|
|
COPY --from=frontend /frontend-build/dist ./server/dist
|
2021-12-12 11:43:27 +08:00
|
|
|
|
2023-02-23 00:07:16 +08:00
|
|
|
RUN go build -o memos ./main.go
|
2021-12-12 11:43:27 +08:00
|
|
|
|
|
|
|
# Make workspace with above generated files.
|
2022-11-19 14:51:28 +08:00
|
|
|
FROM alpine:3.16 AS monolithic
|
2021-12-12 11:43:27 +08:00
|
|
|
WORKDIR /usr/local/memos
|
|
|
|
|
2023-04-08 17:57:00 +08:00
|
|
|
RUN apk add --no-cache tzdata
|
|
|
|
ENV TZ="UTC"
|
|
|
|
|
2021-12-12 11:43:27 +08:00
|
|
|
COPY --from=backend /backend-build/memos /usr/local/memos/
|
|
|
|
|
2023-03-09 08:33:33 +08:00
|
|
|
EXPOSE 5230
|
|
|
|
|
2022-02-05 13:04:06 +08:00
|
|
|
# Directory to store the data, which can be referenced as the mounting point.
|
|
|
|
RUN mkdir -p /var/opt/memos
|
2021-12-12 11:43:27 +08:00
|
|
|
|
2022-08-22 20:52:30 +08:00
|
|
|
ENTRYPOINT ["./memos", "--mode", "prod", "--port", "5230"]
|