Skip to content

Commit

Permalink
Merge pull request #33 from gruntwork-io/feature/permission-update
Browse files Browse the repository at this point in the history
Runner user in action execution
  • Loading branch information
denis256 authored Nov 6, 2023
2 parents 5f1c0b9 + be9646f commit f21ff67
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Dockerfile used in execution of Github Action
FROM gruntwork/terragrunt:0.0.1
FROM gruntwork/terragrunt:0.0.2
MAINTAINER Gruntwork <info@gruntwork.io>

COPY ["./src/main.sh", "/action/main.sh"]

ENTRYPOINT ["/action/main.sh"]
13 changes: 9 additions & 4 deletions terragrunt/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ RUN apt-get update && apt-get install -y \
wget \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /root/.ssh
COPY ./known_hosts /root/.ssh/known_hosts
# Create runner user
RUN addgroup --system --gid 127 docker
RUN useradd --system -u 1001 -g 127 -ms /bin/bash runner
USER runner

RUN mkdir -p /home/runner/.ssh
COPY ./known_hosts /home/runner/.ssh/known_hosts

# clone tfenv
RUN git clone --depth=1 --branch ${TF_ENV_VERSION} https://github.com/tfutils/tfenv.git ~/.tfenv
Expand All @@ -29,9 +34,9 @@ RUN tar -xzf /tmp/tgswitch_${TGSWITCH_VERSION}_linux_amd64.tar.gz -C ${HOME}/tgs
RUN chmod u+x ${HOME}/tgswitch/tgswitch
RUN rm -rf /tmp/tgswitch_${TGSWITCH_VERSION}_linux_amd64.tar.gz

# Running action as Root
# Running action as runner user
# https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user
ENV PATH="/root/.tfenv/bin:/root/tgswitch:/root/bin:${PATH}"
ENV PATH="/home/runner/.tfenv/bin:/home/runner/tgswitch:/home/runner/bin:${PATH}"

ENV TF_INPUT=false
ENV TF_IN_AUTOMATION=1

0 comments on commit f21ff67

Please sign in to comment.