med-notes/resource-provider/Dockerfile
2025-06-26 03:35:15 +00:00

42 lines
868 B
Docker

# Resource Provider (Node.js + Nginx) Dockerfile
FROM node:20-alpine
# Install nginx
RUN apk add --no-cache nginx
# Set working directory
WORKDIR /app
# Install pnpm globally
RUN npm install -g pnpm
# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml* ./
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy the rest of the application
COPY . .
COPY nginx.conf /etc/nginx/http.d/default.conf
# Create directories
RUN mkdir -p /var/log/nginx /var/lib/nginx/tmp /static-files
# Create non-root user for security
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nodejs -u 1001
# Set permissions
RUN chown -R nodejs:nginx /static-files
RUN chown -R nginx:nginx /var/log/nginx /var/lib/nginx
# Switch to non-root user
USER nodejs
# Expose ports
EXPOSE 3000 80
# Start both nginx and node
CMD ["sh", "-c", "nginx && node server.js"]