Add Dockerfile

This commit is contained in:
Henry Mao 2025-02-12 20:01:34 +08:00
parent 87ad925d48
commit 7089549cd0

36
Dockerfile Normal file
View File

@ -0,0 +1,36 @@
# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use a Node.js image for the build
FROM node:20-alpine AS builder
# Install yt-dlp
RUN apk add --no-cache yt-dlp
# Set the working directory
WORKDIR /app
# Copy necessary files
COPY package.json tsconfig.json /app/
COPY src /app/src
# Install dependencies
RUN --mount=type=cache,target=/root/.npm \
npm install --ignore-scripts
# Build the TypeScript files
RUN npm run prepare
# Create a new image for the runtime
FROM node:20-alpine AS runtime
# Copy yt-dlp from the builder
COPY --from=builder /usr/bin/yt-dlp /usr/bin/yt-dlp
# Set the working directory
WORKDIR /app
# Copy the built files and node modules from the builder
COPY --from=builder /app/lib /app/lib
COPY --from=builder /app/node_modules /app/node_modules
# Set the command to run the MCP server
ENTRYPOINT ["node", "lib/index.mjs"]