Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +10 -14
Dockerfile
CHANGED
|
@@ -1,33 +1,29 @@
|
|
| 1 |
-
# SRI API - Hugging Face Spaces
|
| 2 |
-
|
| 3 |
-
FROM node:18-slim
|
| 4 |
|
| 5 |
-
# Set working directory
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
-
# Install Git
|
| 9 |
-
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
# Accept GitHub token as build argument
|
| 12 |
ARG GITHUB_TOKEN
|
| 13 |
-
ENV GITHUB_TOKEN=${GITHUB_TOKEN}
|
| 14 |
|
| 15 |
-
# Clone
|
| 16 |
-
|
| 17 |
-
|
|
|
|
| 18 |
|
| 19 |
# Install dependencies
|
| 20 |
RUN npm install
|
| 21 |
|
| 22 |
-
# Create public directory
|
| 23 |
RUN mkdir -p public
|
| 24 |
|
| 25 |
-
# Expose port 7860 (Hugging Face Spaces default)
|
| 26 |
EXPOSE 7860
|
| 27 |
|
| 28 |
-
# Set environment variables for Hugging Face
|
| 29 |
ENV PORT=7860
|
| 30 |
ENV NODE_ENV=production
|
|
|
|
| 31 |
|
| 32 |
-
# Start the application
|
| 33 |
CMD ["node", "server.js"]
|
|
|
|
| 1 |
+
# SRI API - Hugging Face Spaces Dockerfile (Fixed)
|
| 2 |
+
FROM node:20-slim
|
|
|
|
| 3 |
|
|
|
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
+
# Install Git
|
| 7 |
+
RUN apt-get update && apt-get install -y git ca-certificates && rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
# Accept GitHub token as build argument
|
| 10 |
ARG GITHUB_TOKEN
|
|
|
|
| 11 |
|
| 12 |
+
# Clone private repo (token not stored in final image)
|
| 13 |
+
RUN git clone https://${GITHUB_TOKEN}@github.com/Walukapah/SRIAPI26.git /tmp/repo && \
|
| 14 |
+
cp -r /tmp/repo/* . && \
|
| 15 |
+
rm -rf /tmp/repo .git
|
| 16 |
|
| 17 |
# Install dependencies
|
| 18 |
RUN npm install
|
| 19 |
|
| 20 |
+
# Create public directory
|
| 21 |
RUN mkdir -p public
|
| 22 |
|
|
|
|
| 23 |
EXPOSE 7860
|
| 24 |
|
|
|
|
| 25 |
ENV PORT=7860
|
| 26 |
ENV NODE_ENV=production
|
| 27 |
+
ENV GITHUB_TOKEN=""
|
| 28 |
|
|
|
|
| 29 |
CMD ["node", "server.js"]
|