# 代码发布

# 前端发布

// Dockerfile
# build stage
FROM node:10 as build-stage

LABEL maintainer=brian@toimc.com

# 创建一个工作目录
WORKDIR /app

COPY . .

RUN yarn install --registry=https://registry.npm.taobao.org

RUN npm run build

# production stage
FROM nginx:stable-alpine as production-stage

COPY --from=build-stage /app/dist /usr/share/nginx/html

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]

# 后端发布

// Dockerfile
FROM node:10 

LABEL maintainer=brian@toimc.com

# 创建一个工作目录
WORKDIR /app

COPY . .

RUN yarn install --registry=https://registry.npm.taobao.org

# 这里产生了dist目录,及server.bundle.js
RUN npm run build

EXPOSE 12005

VOLUME [ "/app/public" ]

CMD ["node", "dist/server.bundle.js"]
上次更新: 2/13/2025, 3:29:47 AM