Update Dockerfile
Browse files- Dockerfile +34 -13
Dockerfile
CHANGED
@@ -1,19 +1,40 @@
|
|
1 |
-
#
|
2 |
-
|
3 |
-
|
4 |
-
RUN apk add --no-cache nodejs npm git
|
5 |
|
6 |
-
|
7 |
|
8 |
-
|
9 |
-
USER app
|
10 |
-
WORKDIR /home/app
|
11 |
|
12 |
-
RUN
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
# 暴露端口5230
|
16 |
EXPOSE 5230
|
17 |
|
18 |
-
#
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"]
|