Dockerfile 844 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Build frontend dist.
  2. FROM node:20-alpine AS frontend
  3. WORKDIR /frontend-build
  4. COPY . .
  5. WORKDIR /frontend-build/web
  6. RUN corepack enable && pnpm i --frozen-lockfile
  7. RUN pnpm build
  8. # Build backend exec file.
  9. FROM golang:1.23-alpine AS backend
  10. WORKDIR /backend-build
  11. COPY . .
  12. COPY --from=frontend /frontend-build/web/dist /backend-build/server/router/frontend/dist
  13. RUN CGO_ENABLED=0 go build -o memos ./bin/memos/main.go
  14. # Make workspace with above generated files.
  15. FROM alpine:latest AS monolithic
  16. WORKDIR /usr/local/memos
  17. RUN apk add --no-cache tzdata
  18. ENV TZ="UTC"
  19. COPY --from=backend /backend-build/memos /usr/local/memos/
  20. EXPOSE 5230
  21. # Directory to store the data, which can be referenced as the mounting point.
  22. RUN mkdir -p /var/opt/memos
  23. VOLUME /var/opt/memos
  24. ENV MEMOS_MODE="prod"
  25. ENV MEMOS_PORT="5230"
  26. ENTRYPOINT ["./memos"]