akborana4 commited on
Commit
9427dfc
·
verified ·
1 Parent(s): edbf5f9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -6
Dockerfile CHANGED
@@ -2,7 +2,6 @@
2
  FROM node:18-alpine AS client
3
  WORKDIR /app/client
4
 
5
- # Install client dependencies
6
  COPY client/package.json ./
7
  RUN npm install
8
  COPY client/ ./
@@ -12,21 +11,27 @@ RUN npm run build
12
  FROM node:18-alpine AS server
13
  WORKDIR /app/server
14
 
 
 
 
 
 
 
 
 
15
  # Install server dependencies
16
  COPY server/package.json ./
17
  RUN npm install
 
 
18
  COPY server/ ./
19
 
20
- # Bring in client build
21
  RUN mkdir -p ../client/dist
22
  COPY --from=client /app/client/dist ../client/dist
23
 
24
- # Environment
25
  ENV NODE_ENV=production
26
  ENV PORT=3000
27
- # Provide your ytdl.php API key in HF Space settings:
28
- # Variables and secrets -> Add variable -> Name: YTDL_API_KEY Value: your-key
29
- ENV YTDL_API_KEY="akay"
30
 
31
  EXPOSE 3000
32
  CMD ["npm", "start"]
 
2
  FROM node:18-alpine AS client
3
  WORKDIR /app/client
4
 
 
5
  COPY client/package.json ./
6
  RUN npm install
7
  COPY client/ ./
 
11
  FROM node:18-alpine AS server
12
  WORKDIR /app/server
13
 
14
+ # Install yt-dlp and Python
15
+ RUN addgroup -g 1001 -S nodejs && \
16
+ adduser -S nextjs -u 1001 && \
17
+ apk add --no-cache curl python3 py3-pip && \
18
+ curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp \
19
+ -o /usr/local/bin/yt-dlp && \
20
+ chmod a+rx /usr/local/bin/yt-dlp
21
+
22
  # Install server dependencies
23
  COPY server/package.json ./
24
  RUN npm install
25
+
26
+ # Copy server source
27
  COPY server/ ./
28
 
29
+ # Bring in built client
30
  RUN mkdir -p ../client/dist
31
  COPY --from=client /app/client/dist ../client/dist
32
 
 
33
  ENV NODE_ENV=production
34
  ENV PORT=3000
 
 
 
35
 
36
  EXPOSE 3000
37
  CMD ["npm", "start"]