Permission Denied Error in ECS Docker

Terragrunt gives the permission denied error while it try to open the terragrunt.hcl file in ecs fargate instance not sure what is going on wrong for an instance placing the dockerfile and logs content as well

FROM runatlantis/atlantis:latest


RUN apk add python3 &&
apk add py3-pip &&
pip3 --no-cache-dir install --upgrade awscli &&
apk add jq


COPY terragrunt.hcl /usr/local/bin/terragrunt.hcl
RUN chmod +x /usr/local/bin/terragrunt.hcl

COPY /home/atlantis/
RUN chmod +x /home/atlantis/


Download Terragrunt

RUN curl -s -Lo terragrunt${TERRAGRUNT_VERSION}/terragrunt_linux_amd64 &&
chmod +x terragrunt &&
mv terragrunt /usr/local/bin && chmod +x /usr/local/bin/terragrunt &&
terragrunt --version | grep “v${TERRAGRUNT}”

RUN chown -R atlantis:atlantis /usr/local/bin/atlantis

COPY /home/atlantis/
COPY policies /home/atlantis/policies/
COPY workflow.yaml /home/atlantis/workflow.yaml

CMD [“server”]

And while executing it I get the below error :

exit status 1: running "terragrunt hclfmt --terragrunt-hclfmt-file /usr/local/bin/terragrunt.hcl" in "/home/atlantis/repos/ninjahck/IAC/21/default": 
time=2021-07-28T14:05:41Z level=info msg=Formatting hcl file at: /usr/local/bin/terragrunt.hcl.
time=2021-07-28T14:05:41Z level=info msg=Formatting /usr/local/bin/terragrunt.hcl
time=2021-07-28T14:05:41Z level=error msg=open /usr/local/bin/terragrunt.hcl: permission denied
time=2021-07-28T14:05:41Z level=error msg=Unable to determine underlying exit code, so Terragrunt will exit with error code 1

We at Gruntwork don’t support Atlantis, so I recommend reposting this question on the Atlantis slack channel or Gitter channel referenced on their repo docs (GitHub - runatlantis/atlantis: Terraform Pull Request Automation).

That said, my best guess as to the problem is that atlantis is running as the atlantis OS user, but you are loading the terragrunt.hcl file into the docker container as root. Does it work if you chown the terragrunt.hcl file to atlantis:atlantis?