Skip to content

Commit eaa9601

Browse files
authored
Merge pull request #63 from ONS-Innovation/KEH-2058-ecs-scp-fixes
KEH-2058 - ECS SCP Fixes
2 parents 6dfd9fa + d5e700b commit eaa9601

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ WORKDIR /app
1010
# Copy the current directory contents into the container at /app
1111
COPY . /app
1212

13+
# Run as non-root user for security
14+
RUN useradd -m appuser
15+
USER appuser
16+
1317
# Run poetry install --without dev
1418
RUN poetry install --only main --no-root
1519

terraform/dashboard/main.tf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ resource "aws_ecs_task_definition" "ecs_service_definition" {
3333
appProtocol = "http"
3434
}
3535
],
36+
readonlyRootFilesystem = true,
3637
environment = [
3738
{
3839
name = "AWS_ACCESS_KEY_ID"
@@ -117,10 +118,7 @@ resource "aws_ecs_service" "application" {
117118
network_configuration {
118119
subnets = data.terraform_remote_state.ecs_infrastructure.outputs.private_subnets
119120
security_groups = [aws_security_group.allow_rules_service.id]
120-
121-
# TODO: The container fails to launch unless a public IP is assigned
122-
# For a private ip, you would need to use a NAT Gateway?
123-
assign_public_ip = true
121+
assign_public_ip = false
124122
}
125123

126124
}

0 commit comments

Comments
 (0)