Pārlūkot izejas kodu

Dockerfile

master
feing pirms 9 mēnešiem
vecāks
revīzija
6f32a12866
4 mainītis faili ar 18 papildinājumiem un 9 dzēšanām
  1. 4
    0
      .gitignore
  2. 12
    7
      Dockerfile
  3. 1
    1
      docker-compose-test.yml
  4. 1
    1
      docker-compose.yml

+ 4
- 0
.gitignore Parādīt failu

*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?

dc-rcsc-web.yaml
dc-rcsc-web-test.yaml
readme-web.md

+ 12
- 7
Dockerfile Parādīt failu

# 使用 Node 作为基础镜像 # 使用 Node 作为基础镜像
FROM node:17
FROM registry.cn-hangzhou.aliyuncs.com/zsanyu/rcsc:amd64-node-21 as builder


# 设置工作目录 # 设置工作目录
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./


# 安装依赖 # 安装依赖
RUN npx vite build
RUN npm config set registry https://registry.npmmirror.com && \
npm install


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


# 构建项目 # 构建项目
RUN npm run build
RUN npx vite build


# 暴露端口
EXPOSE 3000
FROM nginx:stable-alpine


# 启动应用
CMD ["npm", "run", "serve"]
RUN rm -rf /etc/nginx/conf.d/default.conf

COPY --from=builder /app/dist /usr/share/nginx/html
COPY --from=builder /app/default-nginx.conf /etc/nginx/conf.d/default.conf

# 暴露端口
EXPOSE 80

+ 1
- 1
docker-compose-test.yml Parādīt failu

build: build:
context: . context: .
dockerfile: ./Dockerfile dockerfile: ./Dockerfile
image: registry.cn-hangzhou.aliyuncs.com/anyu1/rcsc:rcsc_web_test_latest
image: registry.cn-hangzhou.aliyuncs.com/zsanyu/rcsc:rcsc_web_test_latest

+ 1
- 1
docker-compose.yml Parādīt failu

build: build:
context: . context: .
dockerfile: ./Dockerfile dockerfile: ./Dockerfile
image: registry.cn-hangzhou.aliyuncs.com/anyu1/rcsc:rcsc_web_prod_latest
image: registry.cn-hangzhou.aliyuncs.com/zsanyu/rcsc:rcsc_web_prod_latest

Notiek ielāde…
Atcelt
Saglabāt