File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ WORKDIR /app
1010# Copy the current directory contents into the container at /app
1111COPY . /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
1418RUN poetry install --only main --no-root
1519
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments