ytb commited on
Commit
926ab5a
1 Parent(s): b194746

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -13
Dockerfile CHANGED
@@ -1,19 +1,40 @@
1
- # 使用huggingface的基础镜像
2
- # FROM huggingface/transformers:latest
3
- FROM alpine AS builder
4
- RUN apk add --no-cache nodejs npm git
5
 
6
- RUN npm install npm -g
7
 
8
- RUN adduser -D app
9
- USER app
10
- WORKDIR /home/app
11
 
12
- RUN git clone https://github.com/usememos/memos.git
13
- WORKDIR /home/app/memos
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
- # 暴露端口5230
16
  EXPOSE 5230
17
 
18
- # 运行memos应用
19
- CMD ["neosmemo/memos:stable"]
 
 
 
 
 
 
 
1
+ # Build frontend dist.
2
+ FROM node:20-alpine AS frontend
3
+ WORKDIR /frontend-build
 
4
 
5
+ COPY . .
6
 
7
+ WORKDIR /frontend-build/web
 
 
8
 
9
+ RUN corepack enable && pnpm i --frozen-lockfile
10
+
11
+ RUN pnpm build
12
+
13
+ # Build backend exec file.
14
+ FROM golang:1.22-alpine AS backend
15
+ WORKDIR /backend-build
16
+
17
+ COPY . .
18
+
19
+ RUN CGO_ENABLED=0 go build -o memos ./bin/memos/main.go
20
+
21
+ # Make workspace with above generated files.
22
+ FROM alpine:latest AS monolithic
23
+ WORKDIR /usr/local/memos
24
+
25
+ RUN apk add --no-cache tzdata
26
+ ENV TZ="UTC"
27
+
28
+ COPY --from=frontend /frontend-build/web/dist /usr/local/memos/dist
29
+ COPY --from=backend /backend-build/memos /usr/local/memos/
30
 
 
31
  EXPOSE 5230
32
 
33
+ # Directory to store the data, which can be referenced as the mounting point.
34
+ RUN mkdir -p /var/opt/memos
35
+ VOLUME /var/opt/memos
36
+
37
+ ENV MEMOS_MODE="prod"
38
+ ENV MEMOS_PORT="5230"
39
+
40
+ ENTRYPOINT ["./memos"]