Skip to content

Commit 3846097

Browse files
authored
Update Dockerfile
1 parent 1316a46 commit 3846097

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

Dockerfile

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
1-
# Use Node.js version 14 as the base image
2-
FROM node:14
1+
# 使用官方的 Nginx 镜像作为基础镜像
2+
FROM nginx:alpine
33

4-
# Set the working directory inside the container
5-
WORKDIR /app
4+
# 将构建的静态文件拷贝到 Nginx 的默认站点目录
5+
COPY site /usr/share/nginx/html
66

7-
# Copy package.json and package-lock.json (if present) to the working directory
8-
COPY package*.json ./
9-
10-
# Install npm dependencies
11-
RUN npm install
12-
13-
# Copy all files from the current directory to the working directory in the container
14-
COPY . .
15-
16-
# Expose port 80 to allow communication to/from the container
7+
# 暴露 80 端口
178
EXPOSE 80
189

19-
# Specify the command to run the application
20-
CMD ["npm", "start"]
10+
# 默认启动 Nginx 服务
11+
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)