Dockerfile 757 B

1234567891011121314151617181920212223242526272829303132333435
  1. # Build frontend dist.
  2. FROM node:18.12.1-alpine3.16 AS frontend
  3. WORKDIR /frontend-build
  4. COPY ./web/package.json ./web/yarn.lock ./
  5. RUN yarn
  6. COPY ./web/ .
  7. RUN yarn build
  8. # Build backend exec file.
  9. FROM golang:1.19.3-alpine3.16 AS backend
  10. WORKDIR /backend-build
  11. RUN apk update && apk add --no-cache gcc musl-dev
  12. COPY . .
  13. COPY --from=frontend /frontend-build/dist ./server/dist
  14. RUN go build -o memos ./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. EXPOSE 5230
  20. # Directory to store the data, which can be referenced as the mounting point.
  21. RUN mkdir -p /var/opt/memos
  22. ENTRYPOINT ["./memos", "--mode", "prod", "--port", "5230"]