discord-music-bot/Dockerfile
aki 3c4dc51855 refactor: Convert project from JavaScript to TypeScript
- Converted all .js files to .ts
- Added TypeScript configuration (tsconfig.json)
- Added ESLint and Prettier configuration
- Updated package.json dependencies
- Modified Docker and application configurations
2025-04-24 13:48:10 +08:00

46 lines
1.1 KiB
Docker

# ---- Build Stage ----
FROM node:23-alpine AS builder
WORKDIR /app
# Install pnpm and necessary build tools (if native modules are used)
RUN apk add --no-cache python3 make g++ pnpm
# Copy package manifests
COPY package.json pnpm-lock.yaml ./
# Install ALL dependencies (including devDependencies needed for build)
RUN pnpm install --frozen-lockfile
# Copy the rest of the source code
COPY . .
# Compile TypeScript
RUN pnpm run build
# Prune devDependencies after build (optional but good practice)
RUN pnpm prune --prod
# ---- Production Stage ----
FROM node:23-alpine
WORKDIR /app
ENV NODE_ENV=production
# Copy necessary files from the builder stage
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./package.json
# Copy other runtime necessities (adjust if needed)
# COPY .env.example ./
# COPY application.yml ./
# COPY plugins ./plugins
# Expose port if needed (though likely not for a Discord bot)
# EXPOSE 3000
# Run the compiled JavaScript application
CMD ["node", "dist/index.js"]