Skip to content

Commit

Permalink
fix: go back to root user in Dockefile
Browse files Browse the repository at this point in the history
Fixes: #101

Based on [GitHub docs]() we will not be able to access the workspace
of the GitHub Action without being the root user.  As a non-root user
we won't be able to write to `$GITHUB_OUTPUT` which is an environment
variable that is a path inside the workspace and GitHub Actions
using to handle output from the GitHub Action.

Once that was realized, this seems to be the only possible path.

fix: ignore checkov linter requiring user in Dockerfile

Signed-off-by: jmeridth <[email protected]>
  • Loading branch information
jmeridth committed Mar 18, 2024
1 parent 841336f commit eee235e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#checkov:skip=CKV_DOCKER_2
#checkov:skip=CKV_DOCKER_3
FROM python:3.12-slim
LABEL com.github.actions.name="stale-repos" \
com.github.actions.description="Find stale repositories in a GitHub organization." \
Expand All @@ -14,14 +15,10 @@ LABEL com.github.actions.name="stale-repos" \
WORKDIR /action/workspace
COPY requirements.txt stale_repos.py /action/workspace/

RUN useradd -m appuser \
&& chown -R appuser:appuser /action/workspace \
&& python3 -m pip install --no-cache-dir -r requirements.txt \
RUN python3 -m pip install --no-cache-dir -r requirements.txt \
&& apt-get -y update \
&& apt-get -y install --no-install-recommends git-all=1:2.39.2-1.1 \
&& rm -rf /var/lib/apt/lists/*

USER appuser

CMD ["/action/workspace/stale_repos.py"]
ENTRYPOINT ["python3", "-u"]

0 comments on commit eee235e

Please sign in to comment.