test / Dockerfile
akborana4's picture
Update Dockerfile
9427dfc verified
# ---------- 1) Build the React client ----------
FROM node:18-alpine AS client
WORKDIR /app/client
COPY client/package.json ./
RUN npm install
COPY client/ ./
RUN npm run build
# ---------- 2) Build the Node server ----------
FROM node:18-alpine AS server
WORKDIR /app/server
# Install yt-dlp and Python
RUN addgroup -g 1001 -S nodejs && \
adduser -S nextjs -u 1001 && \
apk add --no-cache curl python3 py3-pip && \
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp \
-o /usr/local/bin/yt-dlp && \
chmod a+rx /usr/local/bin/yt-dlp
# Install server dependencies
COPY server/package.json ./
RUN npm install
# Copy server source
COPY server/ ./
# Bring in built client
RUN mkdir -p ../client/dist
COPY --from=client /app/client/dist ../client/dist
ENV NODE_ENV=production
ENV PORT=3000
EXPOSE 3000
CMD ["npm", "start"]