Repository: phidatahq/phidata
File: libs/agno_infra/agno/aws/app/base.py (Python)

Code before:
                    "options": {
                        "awslogs-group": self.get_app_name(),
                        "awslogs-region": build_context.aws_region
                        or (self.infra_settings.aws_region if self.infra_settings else None),
                        "awslogs-create-group": "true",
                        "awslogs-stream-prefix": nginx_container_name,
                    },
                },
                mount_points=[
                    {
                        "sourceVolume": nginx_shared_volume.name,
                        "containerPath": container_context.infra_root,
                    }
                ],
                linux_parameters=ecs_container.linux_parameters,
                env_from_secrets=ecs_container.env_from_secrets,
                save_output=ecs_container.save_output,
                output_dir=ecs_container.output_dir,
                skip_create=ecs_container.skip_create,
                skip_delete=ecs_container.skip_delete,
                wait_for_create=ecs_container.wait_for_create,
                wait_for_delete=ecs_container.wait_for_delete,
            )

            # Add shared volume to ecs_container (copy list to avoid aliasing)
            ecs_container.mount_points = list(nginx_container.mount_points)

        # -*- Add user-defined mount points to ecs_container
        if self.ecs_container_mount_points and ecs_container is not None:
            if ecs_container.mount_points:
                ecs_container.mount_points.extend(self.ecs_container_mount_points)
            else:
                ecs_container.mount_points = list(self.ecs_container_mount_points)

        # -*- Get ECS Task Definition
        ecs_task_definition: EcsTaskDefinition = self.get_ecs_task_definition(ecs_container=ecs_container)
        # -*- Add nginx container to ecs_task_definition if nginx is enabled
        if self.enable_nginx:
            if ecs_task_definition is not None:
                if nginx_container is not None:
                    if ecs_task_definition.containers:
                        ecs_task_definition.containers.append(nginx_container)
                    else:
                        logger.error("While adding Nginx container, found TaskDefinition.containers to be None")
                else:
                    logger.error("While adding Nginx container, found nginx_container to be None")
                if nginx_shared_volume:
                    ecs_task_definition.volumes = [nginx_shared_volume]

        # -*- Add user-defined volumes to ecs_task_definition
        if self.ecs_volumes and ecs_task_definition is not None:

Review comment (bug):
**BONUS FIX**: Changed from direct assignment to `list()` copy. Previously, both containers shared the same list object, causing user mount points to accidentally appear on nginx container. Bug existed since initial commit (2023-11-24, Ashpreet Bedi).

Code after:
                        "awslogs-group": self.get_app_name(),
                        "awslogs-region": build_context.aws_region
                        or (self.infra_settings.aws_region if self.infra_settings else None),
                        "awslogs-create-group": "true",
                        "awslogs-stream-prefix": nginx_container_name,
                    },
                },
                mount_points=[
                    {
                        "sourceVolume": nginx_shared_volume.name,
                        "containerPath": container_context.infra_root,
                    }
                ],
                linux_parameters=ecs_container.linux_parameters,
                env_from_secrets=ecs_container.env_from_secrets,
                save_output=ecs_container.save_output,
                output_dir=ecs_container.output_dir,
                skip_create=ecs_container.skip_create,
                skip_delete=ecs_container.skip_delete,
                wait_for_create=ecs_container.wait_for_create,
                wait_for_delete=ecs_container.wait_for_delete,
            )

            # Add shared volume to ecs_container (copy list to avoid aliasing)
            ecs_container.mount_points = list(nginx_container.mount_points) if nginx_container.mount_points else []

        # -*- Add user-defined mount points to ecs_container
        if self.ecs_container_mount_points and ecs_container is not None:
            if ecs_container.mount_points:
                ecs_container.mount_points.extend(self.ecs_container_mount_points)
            else:
                ecs_container.mount_points = list(self.ecs_container_mount_points)

        # -*- Get ECS Task Definition
        ecs_task_definition: EcsTaskDefinition = self.get_ecs_task_definition(ecs_container=ecs_container)
        # -*- Add nginx container to ecs_task_definition if nginx is enabled
        if self.enable_nginx:
            if ecs_task_definition is not None:
                if nginx_container is not None:
                    if ecs_task_definition.containers:
                        ecs_task_definition.containers.append(nginx_container)
                    else:
                        logger.error("While adding Nginx container, found TaskDefinition.containers to be None")
                else:
                    logger.error("While adding Nginx container, found nginx_container to be None")
                if nginx_shared_volume:
                    ecs_task_definition.volumes = [nginx_shared_volume]

        # -*- Add user-defined volumes to ecs_task_definition
        ecs_volumes = self.get_ecs_volumes()
        if ecs_volumes and ecs_task_definition is not None: