FROM node:22-alpine

# Install netcat for port checking
RUN apk add --no-cache netcat-openbsd

# Set working directory
WORKDIR /opt/app

# Copy package files
COPY package*.json ./

# Install dependencies
RUN npm ci --only=production

# Copy source code
COPY . .

# Build the application
RUN npm run build

# Make startup script executable
RUN chmod +x start.sh

# Expose port
EXPOSE 1337

# Start the application with the startup script
CMD ["./start.sh"] 