FROM node:18-alpine
WORKDIR /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
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S mcp -u 1001
# Change ownership of the app directory
RUN chown -R mcp:nodejs /app
USER mcp
# Expose port (not used for stdio but good practice)
EXPOSE 3000
# Set environment variables
ENV NODE_ENV=production
ENV OPEN_FOOD_FACTS_BASE_URL=https://world.openfoodfacts.net
# Run the server
CMD ["node", "dist/index.js"]