sai / Dockerfile
gitdeem's picture
Upload 3 files
7a2dc96 verified
FROM node:20 AS build
# 添加 git,以便之后能从GitHub克隆项目
RUN apt install git
# 从 GitHub 克隆项目到 /app 目录下
RUN git clone https://github.com/yokingma/search_with_ai.git /app
COPY ./logo.png /app/web/src/assets/logo.png
COPY ./logo.png /app/web/src/public/favicon.ico
COPY ./home.vue /app/web/src/pages/home.vue
COPY ./toolbar.vue /app/web/src/components/toolbar.vue
COPY ./constant.ts /app/backend/utils/constant.ts
COPY ./app.ts /app/backend/app.ts
WORKDIR /app
RUN yarn install && yarn add axios && yarn run build
WORKDIR /app/web
RUN yarn install && yarn run build
FROM node:20-alpine
WORKDIR /app
# Install dotenvx
RUN curl -fsS https://dotenvx.sh/ | sh
COPY .env /app
COPY --from=build /app/dist ./dist
COPY --from=build /app/backend ./backend
COPY --from=build /app/web/build ./web/build
COPY --from=build /app/package.json ./
# RUN yarn config set registry https://mirrors.cloud.tencent.com/npm/
RUN yarn install --production && yarn cache clean
EXPOSE 3000
CMD yarn run start