Add DevSecOpsApp code with updated Jenkins pipeline for multi-environment deployment

This commit is contained in:
2025-11-30 15:24:19 +05:30
parent 30a2782a79
commit 3d49b0f4de
22 changed files with 22129 additions and 52 deletions

47
frontend/Dockerfile Normal file
View File

@@ -0,0 +1,47 @@
# Multi-stage build for React frontend
FROM node:18-alpine AS build
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source code
COPY public/ ./public/
COPY src/ ./src/
# Build the application
RUN npm run build
# Production stage with Nginx
FROM nginx:alpine AS production
# Copy custom nginx config
COPY nginx.conf /etc/nginx/nginx.conf
# Copy built React app
COPY --from=build /app/build /usr/share/nginx/html
# Create a non-root user for nginx
RUN addgroup -g 1001 -S nginxgroup && \
adduser -S nginxuser -u 1001 -G nginxgroup
# Change ownership of nginx directories
RUN chown -R nginxuser:nginxgroup /var/cache/nginx && \
chown -R nginxuser:nginxgroup /var/log/nginx && \
chown -R nginxuser:nginxgroup /etc/nginx/conf.d && \
chown -R nginxuser:nginxgroup /usr/share/nginx/html
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:80/ || exit 1
# Expose port
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]