Deployment
Deployment guide for the RawStack Web component.
The Web app is containerised and deployed to AWS ECS Fargate, with CloudFront in front of the application for asset caching and request routing.
Build and push to ECR
Use the provided script from the repo root:
./scripts/push-web-to-ecr.sh
# Or with a specific tag:
./scripts/push-web-to-ecr.sh v1.2.3The script builds the Docker image and pushes it to the ECR repository defined by WEB_ECR_REPOSITORY_NAME in infrastructure/aws/.env.
Auto-deployment
The CDK Web stack deploys a Lambda trigger that listens for ECR PUSH events. When a new image is pushed, the trigger starts a new ECS rolling deployment automatically.
Dockerfile
The build uses a multi-stage Dockerfile:
- Builder stage — installs dependencies and runs
next buildwith standalone output enabled - Production stage — copies
.next/standalone,.next/static, andpublic/into a minimal Node 24 Alpine image
This keeps the final image smaller by including only the files needed at runtime.
CloudFront
CloudFront sits in front of the ECS application. Static assets under /_next/static/* are cached at the edge, while dynamic requests continue through to the application.
If static assets need to be invalidated without a new Next.js build hash, create a manual invalidation:
aws cloudfront create-invalidation \
--distribution-id <DISTRIBUTION_ID> \
--paths "/_next/static/*"Custom domain
Set the following in infrastructure/aws/.env before deploying:
WEB_DOMAIN_ENABLED=true
WEB_DOMAIN_NAME=example.com
WEB_DOMAIN_ADD_WWW=true
DOMAIN_HOSTED_ZONE_NAME=example.comThe CDK stack provisions an ACM certificate and attaches it to the CloudFront distribution.