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