Skip to content

Commit e9cd35e

Browse files
committed
fix: make ECS Docker container non-root
1 parent 6dfd9fa commit e9cd35e

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ RUN poetry install --only main --no-root
1616
# Expose the port the app runs on
1717
EXPOSE 8501
1818

19+
# Run as non-root user for security
20+
RUN useradd -m appuser
21+
USER appuser
22+
1923
# Run the dashboard
2024
# Note: ENTRYPOINT cannot be overriden by docker run command
2125
ENTRYPOINT ["poetry", "run", "streamlit", "run", "src/app.py", "--server.port=8501", "--server.address=0.0.0.0"]

terraform/dashboard/main.tf

Lines changed: 1 addition & 0 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"

0 commit comments

Comments
 (0)