GLM2 / Dockerfile
ColamanAI's picture
Update Dockerfile
ef0bbf2 verified
raw
history blame
1.11 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/LLM-Red-Team/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
# Expose the port your app runs on
EXPOSE 8000
# Command to run your app using npm
CMD ["npm", "start"]