Docker Workflow: From Source Code to Secure Images
DOWNLOADING CONCEPT: 1. THE ANATOMY OF A DOCKERFILE...
↳A Dockerfile is the blueprint for creating a container image.
↳Each command creates a new, immutable 'layer' in the Overlay Filesystem.
■FROM alpine:latest: The base image. Always use minimal bases (Alpine, Distroless) to reduce attack surface.
■COPY . /app: Copies files from your host into the image.
■RUN npm install: Executes a command *during the build process* and bakes the result into a new layer.
■ENTRYPOINT ["node", "server.js"]: The exact binary that runs when the container starts. If this process crashes, the container dies.
■CMD ["--port", "8080"]: Default arguments passed to the ENTRYPOINT.
▲ LIVE INCIDENTA junior developer pushed a massive 2.5GB Docker image to ECR. The CI/CD security scanner blocked the deployment citing 45 Critical Vulnerabilities.