Download Dockerfile from ColamanAI/GLM2: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/ColamanAI/GLM2/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/ColamanAI/GLM2/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/ColamanAI/GLM2/resolve/main/Dockerfile
1.19 kB
| # First stage: build environment | |
| FROM node:lts AS BUILD_IMAGE | |
| # Update the package list and install git | |
| RUN apt-get update && apt-get install -y git | |
| WORKDIR /app | |
| # Clone GitHub repository | |
| RUN git clone https://github.com/Sunhaha520/glm-free-api.git /app | |
| # Install dependencies and build the project | |
| RUN yarn install --registry https://registry.npmmirror.com/ && yarn run build | |
| # Second stage: production environment | |
| FROM node:lts-alpine | |
| WORKDIR /app | |
| # Copy the built files and required directories from the build stage | |
| COPY --from=BUILD_IMAGE /app/configs /app/configs | |
| COPY --from=BUILD_IMAGE /app/package.json /app/package.json | |
| COPY --from=BUILD_IMAGE /app/dist /app/dist | |
| COPY --from=BUILD_IMAGE /app/public /app/public | |
| COPY --from=BUILD_IMAGE /app/node_modules /app/node_modules | |
| # Install production dependencies | |
| RUN yarn install --production --registry https://registry.npmmirror.com/ | |
| # Create the log directory and grant write permissions | |
| RUN mkdir -p /app/logs && chmod 777 /app/logs | |
| # Specify port environment variable | |
| ENV PORT 7860 | |
| # Expose port | |
| EXPOSE $PORT | |
| # Specify the command to be executed when the container starts | |
| CMD ["node", "dist/index.js", "--port", "7860"] |