Deployment
Deployment guide for the RawStack Web component.
The Web app is containerised and deployed to AWS ECS Fargate, fronted by CloudFront CDN.
Build and push to ECR
./scripts/push-web-to-ecr.sh
# Or with a tag:
./scripts/push-web-to-ecr.sh v1.2.3The script builds the Docker image using the multi-stage Dockerfile, then pushes it to the ECR repository defined by WEB_ECR_REPOSITORY_NAME in infrastructure/aws/.env.
Dockerfile
- Builder stage — installs dependencies and runs
next buildwithoutput: 'standalone' - Production stage — copies
.next/standalone,.next/static, andpublic/into a minimal Node 24 Alpine image
Container size is kept small by the standalone output — only the files actually used at runtime are included.
Auto-deployment
The CDK Web Stack deploys a Lambda trigger that watches for ECR PUSH events. A new image push automatically initiates an ECS rolling deployment.
CloudFront
The CDK stack places CloudFront in front of the ECS ALB. Static assets (/_next/static/*) are cached at the edge with long TTLs. Dynamic pages pass through to ECS.
If you update static assets without changing the Next.js build hash, invalidate the CloudFront distribution manually:
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.comCDK will create an ACM certificate and attach it to the CloudFront distribution.