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
This commit is contained in:
48
Dockerfile
48
Dockerfile
@@ -1,15 +1,45 @@
|
||||
# ---- 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
|
||||
|
||||
RUN apk add --no-cache python3 make g++ pnpm
|
||||
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
COPY . .
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
CMD ["node", "src/index.js"]
|
||||
# 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"]
|
||||
|
||||
Reference in New Issue
Block a user