FROM node:20-alpine

# Install openssl for SSL certificate generation
RUN apk add --no-cache openssl

WORKDIR /app

# Copy package files from hytale-auth-server
COPY package*.json ./

# Install dependencies
RUN npm ci --only=production

# Copy source files
COPY src ./src
COPY assets ./assets

EXPOSE 3000

# Use debug wrapper as entry point (will fall back to normal app.js if DEBUG_MODE!=true)
CMD ["node", "src/debug-wrapper.js"]
