Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +13 -9
Dockerfile
CHANGED
@@ -1,29 +1,33 @@
|
|
1 |
FROM node:20
|
2 |
|
3 |
# Install git
|
4 |
-
RUN apt-get update && apt-get install -y git
|
5 |
|
6 |
-
# Set build
|
|
|
7 |
ARG GITHUB_TOKEN
|
8 |
|
9 |
-
# Clone the private
|
10 |
-
RUN git clone https
|
11 |
|
12 |
# Set working directory
|
13 |
WORKDIR /usr/src/app
|
14 |
|
15 |
-
# Install dependencies
|
16 |
RUN npm install -g npm@11.4.1
|
17 |
RUN npm install
|
18 |
|
19 |
-
|
20 |
# Create and switch to non-root user
|
21 |
RUN groupadd -r appuser && useradd -r -g appuser appuser
|
|
|
|
|
22 |
RUN chown -R appuser:appuser /usr/src/app
|
|
|
|
|
23 |
USER appuser
|
24 |
|
25 |
-
# Expose
|
26 |
-
EXPOSE
|
27 |
|
28 |
-
# Start
|
29 |
CMD ["npm", "run", "dev"]
|
|
|
1 |
FROM node:20
|
2 |
|
3 |
# Install git
|
4 |
+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
5 |
|
6 |
+
# Set build arguments for GitHub access
|
7 |
+
ARG GITHUB_USERNAME
|
8 |
ARG GITHUB_TOKEN
|
9 |
|
10 |
+
# Clone the private repository securely
|
11 |
+
RUN git clone https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${GITHUB_USERNAME}/prompt-glow-lab-00.git /usr/src/app
|
12 |
|
13 |
# Set working directory
|
14 |
WORKDIR /usr/src/app
|
15 |
|
16 |
+
# Install specific npm version and dependencies
|
17 |
RUN npm install -g npm@11.4.1
|
18 |
RUN npm install
|
19 |
|
|
|
20 |
# Create and switch to non-root user
|
21 |
RUN groupadd -r appuser && useradd -r -g appuser appuser
|
22 |
+
|
23 |
+
# 🧹 Fix permissions AFTER everything is copied
|
24 |
RUN chown -R appuser:appuser /usr/src/app
|
25 |
+
|
26 |
+
# Switch to non-root user
|
27 |
USER appuser
|
28 |
|
29 |
+
# Expose Vite dev port (usually 5173, adjust if needed)
|
30 |
+
EXPOSE 5173
|
31 |
|
32 |
+
# Start dev server
|
33 |
CMD ["npm", "run", "dev"]
|