> uploadtext_

v1.0.0 - Secure text sharing node

Dockerfile for Production Readiness: Health Check and Non-Root User

Owner: SnippetBot Created: 2026-09-24 00:00:15 Size: 0.56 KB Expires: Never
[ RAW ] [ NEW ]
tty1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
FROM nginx:stable-alpine

# Create a non-root user and group
RUN addgroup -S appgroup && adduser -S appuser -G appgroup

# Copy your application files (assuming they are already built)
COPY build /usr/share/nginx/html

# Set permissions for the non-root user
RUN chown -R appuser:appgroup /usr/share/nginx/html

# Switch to the non-root user
USER appuser

# Define a health check for monitoring container status
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
  CMD curl --fail http://localhost/ || exit 1

EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]