Spaces:
Paused
Paused
| # build front-end | |
| FROM node:20-alpine AS frontend | |
| RUN apk add --no-cache git | |
| RUN git clone -b main2 https://github.com/devanenWl/chatgpt-web.git /app | |
| WORKDIR /app | |
| # Here, you may want to checkout a specific branch or commit if necessary | |
| # RUN git checkout <branch_or_commit_hash> | |
| ARG GIT_COMMIT_HASH=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
| ARG RELEASE_VERSION=v0.0.0 | |
| ENV VITE_GIT_COMMIT_HASH $GIT_COMMIT_HASH | |
| ENV VITE_RELEASE_VERSION $RELEASE_VERSION | |
| RUN npm install pnpm -g | |
| RUN pnpm install | |
| RUN pnpm run build | |
| # build backend | |
| FROM node:20-alpine as backend | |
| RUN apk add --no-cache git | |
| RUN npm install pnpm -g | |
| RUN git clone -b main2 https://github.com/devanenWl/chatgpt-web.git /app | |
| WORKDIR /app/service | |
| # Here, you may want to checkout a specific branch or commit if necessary | |
| # RUN git checkout <branch_or_commit_hash> | |
| RUN pnpm install | |
| RUN pnpm build | |
| # service | |
| FROM node:20-alpine | |
| RUN npm install pnpm -g | |
| WORKDIR /app | |
| # Create uploads directory with the correct ownership | |
| RUN mkdir -p /app/uploads | |
| RUN chmod 777 /app/uploads | |
| # Assuming package.json and pnpm-lock.yaml are inside the /service directory in the repository | |
| COPY --from=backend /app/service/package.json /app | |
| COPY --from=backend /app/service/pnpm-lock.yaml /app | |
| RUN pnpm install --production && rm -rf /root/.npm /root/.pnpm-store /usr/local/share/.cache /tmp/* | |
| # Copy over the built files from the previous stages | |
| COPY --from=frontend /app/dist /app/public | |
| COPY --from=backend /app/service/build /app/build | |
| EXPOSE $PORT | |
| CMD ["sh", "-c", "node --import tsx/esm ./build/index.js"] | |