Dockerfile 823 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.22-alpine AS backend
  10. WORKDIR /backend-build
  11. COPY . .
  12. RUN CGO_ENABLED=0 go build -o memos ./bin/memos/main.go
  13. # Make workspace with above generated files.
  14. FROM alpine:latest AS monolithic
  15. WORKDIR /usr/local/memos
  16. RUN apk add --no-cache tzdata
  17. ENV TZ="UTC"
  18. COPY --from=frontend /frontend-build/web/dist /usr/local/memos/dist
  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"]