Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
atorber committed Aug 8, 2023
1 parent ac82622 commit 615ee28
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# 阶段一:构建阶段
FROM node:18.17.0 AS build
# 使用官方Node.js 18镜像(包含基于Ubuntu的节点环境)
FROM node:18.17.0

# 创建工作目录
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install

# 复制当前目录下的所有文件到工作目录
COPY . .
RUN npm run build && \
# 清理不必要的文件
rm -rf node_modules

# 阶段二:最终运行时镜像
FROM node:18.17.0
WORKDIR /usr/src/app
COPY --from=build /usr/src/app/dist ./dist
RUN apt-get update && \
apt-get install -y curl software-properties-common ffmpeg && \
npm install && \
npm install wx-voice -g
CMD ["sh", "-c", "wx-voice compile && npm run start"]

# 启动应用
CMD ["sh", "-c", "wx-voice compile && npm run start"]

0 comments on commit 615ee28

Please sign in to comment.