35 lines
660 B
Docker
35 lines
660 B
Docker
# Use Node.js 18 Alpine for smaller size and faster builds
|
|
FROM node:18-alpine
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install dependencies for native modules
|
|
RUN apk add --no-cache libc6-compat
|
|
|
|
# Copy package files
|
|
COPY package.json pnpm-lock.yaml* ./
|
|
|
|
# Enable pnpm and install dependencies
|
|
RUN corepack enable pnpm
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Disable telemetry for faster builds
|
|
ENV NEXT_TELEMETRY_DISABLED 1
|
|
|
|
# Build the application
|
|
RUN pnpm run build
|
|
|
|
# Expose port
|
|
EXPOSE 3000
|
|
|
|
# Set environment variables
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
# Start the application
|
|
CMD ["pnpm", "start"] |