forked from ztjhz/BetterChatGPT
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Dockerfile
44 lines (28 loc) · 1008 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Stage 1: Build
FROM node:alpine AS builder
RUN addgroup -S appgroup && \
adduser -S appuser -G appgroup && \
mkdir -p /home/appuser/app && \
chown appuser:appgroup /home/appuser/app
USER appuser
RUN yarn config set prefix ~/.yarn && \
yarn global add typescript serve vite
WORKDIR /home/appuser/app
COPY --chown=appuser:appgroup package.json yarn.lock ./
COPY --chown=appuser:appgroup . .
RUN npm install && \
/home/appuser/.yarn/bin/vite optimize && \
/home/appuser/.yarn/bin/vite build --minify
# Stage 2: Run
FROM node:alpine
RUN addgroup -S appgroup && \
adduser -S appuser -G appgroup && \
mkdir -p /home/appuser/app && \
chown appuser:appgroup /home/appuser/app
USER appuser
RUN yarn config set prefix ~/.yarn && \
yarn global add serve
WORKDIR /home/appuser/app
COPY --chown=appuser:appgroup --from=builder /home/appuser/app/dist ./dist
EXPOSE 5001
CMD ["/home/appuser/.yarn/bin/serve", "-s", "dist", "-l", "5001"]