Update Dockerfile
Browse files- Dockerfile +17 -4
Dockerfile
CHANGED
|
@@ -1,8 +1,12 @@
|
|
| 1 |
FROM node:lts AS BUILD_IMAGE
|
| 2 |
|
|
|
|
|
|
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
RUN yarn install --registry https://registry.npmmirror.com/ && yarn run build
|
| 8 |
|
|
@@ -14,8 +18,17 @@ COPY --from=BUILD_IMAGE /app/dist /app/dist
|
|
| 14 |
COPY --from=BUILD_IMAGE /app/public /app/public
|
| 15 |
COPY --from=BUILD_IMAGE /app/node_modules /app/node_modules
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
| 1 |
FROM node:lts AS BUILD_IMAGE
|
| 2 |
|
| 3 |
+
# Update the package list and install git
|
| 4 |
+
RUN apt-get update && apt-get install -y git
|
| 5 |
+
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
+
# Pull GitHub repository
|
| 9 |
+
RUN git clone https://github.com/LLM-Red-Team/glm-free-api.git /app
|
| 10 |
|
| 11 |
RUN yarn install --registry https://registry.npmmirror.com/ && yarn run build
|
| 12 |
|
|
|
|
| 18 |
COPY --from=BUILD_IMAGE /app/public /app/public
|
| 19 |
COPY --from=BUILD_IMAGE /app/node_modules /app/node_modules
|
| 20 |
|
| 21 |
+
# Install production dependencies
|
| 22 |
+
RUN yarn install --production --registry https://registry.npmmirror.com/
|
| 23 |
+
|
| 24 |
+
# Create the log directory and grant write permissions
|
| 25 |
+
RUN mkdir -p /app/logs && chmod 777 /app/logs
|
| 26 |
+
|
| 27 |
+
# Specify port environment variable
|
| 28 |
+
ENV PORT 7860
|
| 29 |
|
| 30 |
+
# Expose port
|
| 31 |
+
EXPOSE $PORT
|
| 32 |
|
| 33 |
+
# Specify the command to be executed when the container starts
|
| 34 |
+
CMD ["node", "dist/index.js", "--port", "7860"]
|