Dockerfile32 lines, 853 B
| 1 | # ---- Base ---- |
| 2 | FROM node:20-alpine AS base |
| 3 | # Install Python which is required by youtube-dl-exec |
| 4 | RUN apk add --no-cache python3 py3-pip |
| 5 | WORKDIR /usr/src/app |
| 6 | RUN npm install -g pnpm |
| 7 | |
| 8 | # ---- Dependencies ---- |
| 9 | FROM base AS deps |
| 10 | COPY package.json pnpm-lock.yaml* ./ |
| 11 | RUN pnpm install --frozen-lockfile --prod |
| 12 | |
| 13 | # ---- Build ---- |
| 14 | FROM base AS build |
| 15 | COPY package.json pnpm-lock.yaml* ./ |
| 16 | RUN pnpm install --frozen-lockfile |
| 17 | COPY . . |
| 18 | RUN pnpm build |
| 19 | |
| 20 | # ---- Release ---- |
| 21 | FROM base AS release |
| 22 | WORKDIR /usr/src/app |
| 23 | COPY package.json ./ |
| 24 | COPY --from=deps /usr/src/app/node_modules ./node_modules |
| 25 | COPY --from=build /usr/src/app/dist ./dist |
| 26 | COPY --from=build /usr/src/app/google-credentials.json ./google-credentials.json |
| 27 | |
| 28 | # Expose port (Ensure this matches the port in your index.ts or .env) |
| 29 | EXPOSE 8080 |
| 30 | |
| 31 | # Default command to run the app |
| 32 | CMD ["node", "dist/index.js"] |