Dockerfile 890 B

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