memos/Dockerfile

41 lines
832 B
Docker
Raw Normal View History

2023-09-18 18:23:13 +03:00
# Build frontend dist.
FROM node:18-alpine AS frontend
WORKDIR /frontend-build
COPY . .
2023-09-18 18:23:13 +03:00
WORKDIR /frontend-build/web
RUN corepack enable && pnpm i --frozen-lockfile && pnpm type-gen
2021-12-12 06:43:27 +03:00
RUN pnpm build
2021-12-12 06:43:27 +03:00
# Build backend exec file.
2023-08-27 11:08:39 +03:00
FROM golang:1.21-alpine AS backend
2021-12-12 06:43:27 +03:00
WORKDIR /backend-build
COPY . .
COPY --from=frontend /frontend-build/web/dist ./server/dist
2021-12-12 06:43:27 +03:00
2023-12-11 17:16:39 +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.
2023-08-27 11:08:39 +03:00
FROM alpine:latest AS monolithic
2021-12-12 06:43:27 +03:00
WORKDIR /usr/local/memos
RUN apk add --no-cache tzdata
ENV TZ="UTC"
2021-12-12 06:43:27 +03:00
COPY --from=backend /backend-build/memos /usr/local/memos/
EXPOSE 5230
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
VOLUME /var/opt/memos
2021-12-12 06:43:27 +03:00
ENV MEMOS_MODE="prod"
ENV MEMOS_PORT="5230"
ENTRYPOINT ["./memos"]