This message was deleted.
# atlantis-community
s
This message was deleted.
a
So just after I wrote this I worked it out but ill leave it here as a breadcrumb for others. So the way to resolve it is to do the AFTER: part, but at the end of your Dockerfile, switch back to the atlantis user. This might cause other issues in your plays, however this was resolved by changing the user in the tasks. For example, we have an aws config that needs its permissions changing:
Copy code
BEFORE:
- name: Make AWS conf readable by Atlantis
  community.docker.docker_container_exec:
    container: atlantis
    command: /bin/bash -c "chown atlantis:atlantis /home/atlantis/.aws/"
Becomes:
Copy code
AFTER:
- name: Make AWS conf readable by Atlantis
  community.docker.docker_container_exec:
    user: root
    container: atlantis
    command: /bin/bash -c "chown atlantis:atlantis /home/atlantis/.aws/"
And here is the updated snippet to extend the container functionality:
Copy code
FROM <http://ghcr.io/runatlantis/atlantis:v0.27.0-alpine|ghcr.io/runatlantis/atlantis:v0.27.0-alpine>
USER root

ENV VIRTUAL_ENV=/opt/venv
RUN apk add --no-cache python3 python3-dev py3-pip libc-dev libffi-dev gcc jq yq
RUN python3 -m venv $VIRTUAL_ENV
## We can replace source <venv>/activate by setting the appropriate environment variables: Docker's ENV command applies both subsequent RUNs as well as to the CMD.
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN pip3 install --upgrade pip
RUN pip3 install --no-cache-dir \
  'msal==1.4.3' \
  'awscli'
USER atlantis  <--------------- ADD THIS
r
This is a great call out. It probably needs to be documented as part of the release notes. Could you comment this in the above pr for now so it's linkable?
👍 1
a
Yes I can. I will sort it shortly!
👍 1
v
Had the same issue this morning and adding
USER root
solved my issue. I will add the
USER atlantis
at the end as well to avoid any future issues. Thanks for sharing the solution
👍 2
r
cc @Dylan Page @PePe Amengual can we add the above to the release notes? I think many might hit this issue
We may want to add it to the customizing-the-image doc on the website too
p
yes go for it
and definitely we should add it to that section too
👍 1
@Bruno Schaatsbergen
I do not believe there is such section @RB?
ok, sorry we do
r
Did you find it in another section?
r
Ah that's it!
d
We can do a patch release and note it after we PR the new docs
I already merged some new fixes
p
how this sounds?
Copy code
Since version `0.26.0` the atlantis image now uses the `atlantis` user to run atlantis instead of the root user. Previous container definitions and script might need to be adjusted to use the `atlantis` user instead of `root`. If you need to include packages from other images you can switch to the `root` user using `USER root` in your docker file and once you are done installing packages you can switch back to the atlantis user to start atlantis.

It is possible also to use the `/docker-entrypoint.d/` directory to add aditional scripts that you might want to run before the atlantis server starts. This is particulary useful if you want to customize the instance without building your own pipeline for it.
d
LGTM
r
It sounds like there needs to be some chowning too of custom files so it's owned by atlantis:atlantis instead of root:root
👍 1
Ref alex's above messages
cc @Alex Mussell
🙌 1
p
but that is because the root user used to own the files
which is bad
r
Yes exactly and was necessary until atlantis stopped using root user
Which is why it might be good to call that out too, idk
p
I can add that the atlantis data dir needs to readable by the atlantis user
👍 1
d
For the sake of overloading the message, maybe we PR the documentation and then just point them there
p
a
Yeah all of this looks great. I could have done this myself in hindsight but a little bogged down at work, so thanks for adding this to the docs.