2021-12-12 11:43:27 +08:00
|
|
|
# Build frontend dist.
|
2022-07-03 21:37:06 +08:00
|
|
|
FROM node:16.15.0-alpine AS frontend
|
2021-12-12 11:43:27 +08:00
|
|
|
WORKDIR /frontend-build
|
|
|
|
|
|
|
|
COPY ./web/ .
|
|
|
|
|
|
|
|
RUN yarn
|
|
|
|
RUN yarn build
|
|
|
|
|
|
|
|
# Build backend exec file.
|
2022-07-03 21:52:44 +08:00
|
|
|
FROM golang:1.18.3-alpine3.16 AS backend
|
2021-12-12 11:43:27 +08:00
|
|
|
WORKDIR /backend-build
|
|
|
|
|
2022-07-03 22:45:10 +08:00
|
|
|
RUN apk update
|
|
|
|
RUN apk --no-cache add gcc musl-dev
|
|
|
|
|
2021-12-12 11:43:27 +08:00
|
|
|
COPY . .
|
|
|
|
|
|
|
|
RUN go build \
|
|
|
|
-o memos \
|
2022-02-03 15:32:03 +08:00
|
|
|
./bin/server/main.go
|
2021-12-12 11:43:27 +08:00
|
|
|
|
|
|
|
# Make workspace with above generated files.
|
2022-07-03 21:15:43 +08:00
|
|
|
FROM alpine:3.16.0 AS monolithic
|
2021-12-12 11:43:27 +08:00
|
|
|
WORKDIR /usr/local/memos
|
|
|
|
|
|
|
|
COPY --from=backend /backend-build/memos /usr/local/memos/
|
|
|
|
COPY --from=frontend /frontend-build/dist /usr/local/memos/web/dist
|
|
|
|
|
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-02-05 13:04:06 +08:00
|
|
|
ENTRYPOINT ["./memos"]
|