memos/Dockerfile

41 lines
839 B
Text
Raw Normal View History

2021-12-12 11:43:27 +08:00
# Build frontend dist.
FROM node:18.12.1-alpine3.16 AS frontend
2021-12-12 11:43:27 +08:00
WORKDIR /frontend-build
COPY ./web/package.json ./web/pnpm-lock.yaml ./
2023-05-03 19:14:21 +08:00
RUN corepack enable && pnpm i --frozen-lockfile
2021-12-12 11:43:27 +08:00
COPY ./web/ .
RUN pnpm build
2021-12-12 11:43:27 +08:00
# Build backend exec file.
FROM golang:1.19.3-alpine3.16 AS backend
2021-12-12 11:43:27 +08:00
WORKDIR /backend-build
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
RUN CGO_ENABLED=0 go build -o memos ./main.go
2021-12-12 11:43:27 +08:00
# Make workspace with above generated files.
FROM alpine:3.16 AS monolithic
2021-12-12 11:43:27 +08:00
WORKDIR /usr/local/memos
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/
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
VOLUME /var/opt/memos
2021-12-12 11:43:27 +08:00
ENV MEMOS_MODE="prod"
ENV MEMOS_PORT="5230"
ENTRYPOINT ["./memos"]