Browse Source

dockerfile

master
feing 9 months ago
parent
commit
d289ed13eb
4 changed files with 41 additions and 1 deletions
  1. 4
    1
      .gitignore
  2. 23
    0
      Dockerfile
  3. 7
    0
      docker-compose-test.yml
  4. 7
    0
      docker-compose.yml

+ 4
- 1
.gitignore View File

@@ -1,2 +1,5 @@
node_modules

.vscode
p
readme-admin.md
dc-rcsc-admin.yaml

+ 23
- 0
Dockerfile View File

@@ -0,0 +1,23 @@
# 使用 Node 作为基础镜像
FROM node:21

# 设置工作目录
WORKDIR /app

# 拷贝package.json和package-lock.json
COPY package*.json ./

# 安装依赖
RUN npx vite build

# 将项目文件拷贝到工作目录
COPY . .

# 构建项目
RUN npm run build

# 暴露端口
EXPOSE 3000

# 启动应用
CMD ["npm", "run", "serve"]

+ 7
- 0
docker-compose-test.yml View File

@@ -0,0 +1,7 @@
version: "3.3"
services:
api:
build:
context: .
dockerfile: ./Dockerfile
image: registry.cn-hangzhou.aliyuncs.com/zsanyu/rcsc:rcsc_admin_test_latest

+ 7
- 0
docker-compose.yml View File

@@ -0,0 +1,7 @@
version: "3.3"
services:
api:
build:
context: .
dockerfile: ./Dockerfile
image: registry.cn-hangzhou.aliyuncs.com/zsanyu/rcsc:rcsc_admin_prod_latest

Loading…
Cancel
Save