chore: 重构image build

pull/101/head
xiaojunnuo 2024-07-20 19:38:15 +08:00
parent 0ef7b036dd
commit 4afbf20c1a
2 changed files with 37 additions and 0 deletions

23
packages/ui/Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM registry.cn-shenzhen.aliyuncs.com/handsfree/node:18-alpine as builder
EXPOSE 7001
WORKDIR /workspace/
RUN npm install -g pnpm@8.15.7 --registry=https://registry.npmmirror.com
RUN pnpm config set registry https://registry.npmmirror.com/
RUN cd /workspace/certd-client && pnpm install && npm run build
RUN cd /workspace/certd-server && pnpm install && npm run build
RUN cp /workspace/certd-client/dist/* /workspace/certd-server/public/ -rf
FROM registry.cn-shenzhen.aliyuncs.com/handsfree/node:18-alpine
WORKDIR /app/
COPY --from=builder /workspace/certd-server/ /app/
ENV TZ Asia/Shanghai
ENV NODE_ENV production
ENV MIDWAY_SERVER_ENV production
CMD ["npm", "run","start"]

View File

@ -0,0 +1,14 @@
version: '3.3' # 指定docker-compose 版本
services: # 要拉起的服务们
certd:
build:
context: ./
dockerfile: Dockerfile
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${TAG}
container_name: certd # 容器名
restart: unless-stopped # 重启
ports: # 端口映射
- "7001:7001"
environment:
- TZ=Asia/Shanghai