Files
mamad-app/Dockerfile
2025-06-22 00:01:22 +03:00

40 lines
728 B
Docker

# Use Node.js 18 Alpine as base image
FROM node:18-alpine
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install --legacy-peer-deps
# Copy application code
COPY . .
# Create config directory and copy config template
RUN mkdir -p /app/config
COPY config.json /app/config.json
# Build the application
RUN npm run build
# Set default hostname if not provided
ENV HOSTNAME=container
ENV NEXT_PUBLIC_HOSTNAME=container
# Expose port
EXPOSE 3000
# Create non-root user
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
# Change ownership of the app directory
RUN chown -R nextjs:nodejs /app
USER nextjs
# Start the application
CMD ["npm", "start"]