2021-12-12 06:43:27 +03:00
|
|
|
# Build frontend dist.
|
2022-11-19 09:51:28 +03:00
|
|
|
FROM node:18.12.1-alpine3.16 AS frontend
|
2021-12-12 06:43:27 +03:00
|
|
|
WORKDIR /frontend-build
|
|
|
|
|
|
|
|
COPY ./web/ .
|
|
|
|
|
2023-01-14 03:00:07 +03:00
|
|
|
RUN yarn && yarn build
|
2021-12-12 06:43:27 +03:00
|
|
|
|
|
|
|
# Build backend exec file.
|
2022-11-19 09:51:28 +03:00
|
|
|
FROM golang:1.19.3-alpine3.16 AS backend
|
2021-12-12 06:43:27 +03:00
|
|
|
WORKDIR /backend-build
|
|
|
|
|
2023-01-14 03:00:07 +03:00
|
|
|
RUN apk update && apk add --no-cache gcc musl-dev
|
2022-07-03 17:45:10 +03:00
|
|
|
|
2021-12-12 06:43:27 +03:00
|
|
|
COPY . .
|
2022-07-10 04:02:56 +03:00
|
|
|
COPY --from=frontend /frontend-build/dist ./server/dist
|
2021-12-12 06:43:27 +03:00
|
|
|
|
2023-02-22 19:07:16 +03:00
|
|
|
RUN go build -o memos ./main.go
|
2021-12-12 06:43:27 +03:00
|
|
|
|
|
|
|
# Make workspace with above generated files.
|
2022-11-19 09:51:28 +03:00
|
|
|
FROM alpine:3.16 AS monolithic
|
2021-12-12 06:43:27 +03:00
|
|
|
WORKDIR /usr/local/memos
|
|
|
|
|
|
|
|
COPY --from=backend /backend-build/memos /usr/local/memos/
|
|
|
|
|
2022-02-05 08:04:06 +03:00
|
|
|
# Directory to store the data, which can be referenced as the mounting point.
|
|
|
|
RUN mkdir -p /var/opt/memos
|
2021-12-12 06:43:27 +03:00
|
|
|
|
2022-08-22 15:52:30 +03:00
|
|
|
ENTRYPOINT ["./memos", "--mode", "prod", "--port", "5230"]
|