Browse documentation
This Website
Containerisation
Building a lightweight, repeatable runtime image for deployment.
The application is packaged as a Docker image to provide a consistent runtime environment across local development, CI/CD and AWS ECS. The build process produces a single immutable image that can be promoted between environments without modification.
Multi-stage Build
The Dockerfile uses a multi-stage build to separate dependency installation, application compilation and the final runtime image.
Only the standalone Next.js server and required static assets are copied into the production image.
FROM node:24-alpine AS runner
ENV NODE_ENV=production
USER nextjs
CMD ["node", "apps/portfolio-frontend/server.js"]Runtime Configuration
The production image is environment agnostic.
Configuration is supplied when the container starts rather than being embedded during the build process. This allows the same image to be deployed to different environments without rebuilding it.
Runtime configuration is injected by ECS using environment variables sourced from AWS Systems Manager Parameter Store. Sensitive values, such as the Resend API key, are stored as SecureString parameters, while non-sensitive configuration can use standard String parameters.
Amazon ECR
Built images are published to Amazon Elastic Container Registry (ECR).
Each image is tagged using the Git commit SHA and GitHub Actions run attempt, providing a direct relationship between a deployment and the source code that produced it while keeping every published tag unique.
ECS Task Definitions
Amazon ECS deploys containers using task definitions.
Each deployment registers a new task definition revision referencing the specific image stored in ECR. Updating a service simply involves deploying the new revision, allowing ECS to perform a rolling replacement of running tasks.
Deployment Flow
flowchart LR
Source["Git Commit"]
Build["GitHub Actions"]
Image["Docker Image"]
ECR["Amazon ECR"]
ECS["ECS Task Definition"]
Service["ECS Service"]
Source --> Build
Build --> Image
Image --> ECR
ECR --> ECS
ECS --> Service