-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from atorber/dev
Update Dockerfile
- Loading branch information
Showing
1 changed file
with
10 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |