Dockerfile 711 B

12345678910111213141516171819202122232425262728293031
  1. # Build frontend dist.
  2. FROM node:18.12.1-alpine3.16 AS frontend
  3. WORKDIR /frontend-build
  4. COPY ./web/ .
  5. RUN yarn
  6. RUN yarn build
  7. # Build backend exec file.
  8. FROM golang:1.19.3-alpine3.16 AS backend
  9. WORKDIR /backend-build
  10. RUN apk update
  11. RUN apk --no-cache add gcc musl-dev
  12. COPY . .
  13. COPY --from=frontend /frontend-build/dist ./server/dist
  14. RUN go build -o memos ./bin/server/main.go
  15. # Make workspace with above generated files.
  16. FROM alpine:3.16 AS monolithic
  17. WORKDIR /usr/local/memos
  18. COPY --from=backend /backend-build/memos /usr/local/memos/
  19. # Directory to store the data, which can be referenced as the mounting point.
  20. RUN mkdir -p /var/opt/memos
  21. ENTRYPOINT ["./memos", "--mode", "prod", "--port", "5230"]