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

34
backend/Dockerfile Normal file
View File

@@ -0,0 +1,34 @@
# Simple Node.js backend Dockerfile
FROM node:18-alpine
# Set working directory
WORKDIR /app
# Create a non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodeapp -u 1001
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci --only=production && npm cache clean --force
# Copy application files
COPY server.js ./
# Create logs directory and set permissions
RUN mkdir -p logs && chown -R nodeapp:nodejs /app
# Switch to non-root user
USER nodeapp
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3001/health || exit 1
# Expose port
EXPOSE 3001
# Start the application
CMD ["node", "server.js"]