jesonouyang commited on
Commit
77d65eb
·
verified ·
1 Parent(s): 680e87d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -7
Dockerfile CHANGED
@@ -3,11 +3,9 @@ RUN apk add --no-cache git
3
  RUN mkdir /app
4
  WORKDIR /app
5
  # 克隆指定仓库代替COPY
6
- RUN git clone https://github.com/qwertyuiopasdfghjklzxcvbnm0987654321/weibo-rss.git .
7
- RUN ls
8
  RUN npm i -g npm && npm ci --ignore-scripts && npm run build
9
 
10
-
11
  FROM node:18-alpine
12
  LABEL maintainer="https://github.com/zgq354/weibo-rss"
13
  RUN mkdir /app
@@ -18,12 +16,13 @@ RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/
18
  echo "057ecd4ac1d3c3be31f82fc0848bf77b1326a975b4f8423fe31607205a0fe945 /usr/local/bin/dumb-init" | sha256sum -c - && \
19
  chmod 755 /usr/local/bin/dumb-init
20
 
21
- COPY package.json package-lock.json /app/
 
 
22
  RUN npm install --production
23
 
24
- # app code
25
- COPY . /app
26
- COPY --from=builder /app/dist /app/dist
27
 
28
  EXPOSE 3000
29
  ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]
 
3
  RUN mkdir /app
4
  WORKDIR /app
5
  # 克隆指定仓库代替COPY
6
+ RUN git clone https://github.com/qwertyuiopasdfghjklzxcvbnm0987654321/weibo-rss .
 
7
  RUN npm i -g npm && npm ci --ignore-scripts && npm run build
8
 
 
9
  FROM node:18-alpine
10
  LABEL maintainer="https://github.com/zgq354/weibo-rss"
11
  RUN mkdir /app
 
16
  echo "057ecd4ac1d3c3be31f82fc0848bf77b1326a975b4f8423fe31607205a0fe945 /usr/local/bin/dumb-init" | sha256sum -c - && \
17
  chmod 755 /usr/local/bin/dumb-init
18
 
19
+ # 从builder阶段复制依赖清单
20
+ COPY --from=builder /app/package.json /app/package-lock.json ./
21
+ # 安装生产依赖
22
  RUN npm install --production
23
 
24
+ # 从builder阶段复制全部代码(包含构建结果)
25
+ COPY --from=builder /app ./
 
26
 
27
  EXPOSE 3000
28
  ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]