From 32fe044f36aaab48d342c2415308365b0cba16dd Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 12 Nov 2024 21:38:03 +0000 Subject: [PATCH] update to use watcloud-slurm-ci user --- Dockerfile | 14 +++++++------- start.sh | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index fc42b31..3d75e44 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,12 +13,12 @@ COPY main.py config.py runner_size_config.py RunningJob.py allocate-ephemeral-ru # Install Python requirements COPY requirements.txt /home/watcloud-slurm-ci/ RUN pip3 install -r requirements.txt -RUN chmod +x start.sh +RUN chmod +x *.sh -# Run the Python script -# Note the env variable GITHUB_ACCESS_TOKEN will need to be set in order to authenticate with the GitHub API -ENTRYPOINT ["/home/watcloud-slurm-ci/start.sh"] -# ENTRYPOINT ["python3", "/app/main.py"] +# Create watcloud-slurm-ci user with UID 1814 within the container +RUN useradd -u 1814 -m -d /home/watcloud-slurm-ci watcloud-slurm-ci +RUN chown -R watcloud-slurm-ci:watcloud-slurm-ci /home/watcloud-slurm-ci/ -# Custom user for running the CI -# USER watcloud-slurm-ci \ No newline at end of file +# Run the Python script +# Note the env variable GITHUB_ACCESS_TOKEN will need to be set +ENTRYPOINT ["/home/watcloud-slurm-ci/start.sh"] \ No newline at end of file diff --git a/start.sh b/start.sh index 6d7a897..8851d03 100644 --- a/start.sh +++ b/start.sh @@ -14,5 +14,5 @@ done echo "Munge socket is ready. Starting Python script." -# Start the Python script -python3 /home/watcloud-slurm-ci/main.py \ No newline at end of file +# Start the Python script as the watcloud-slurm-ci user +su -s /bin/bash -c "python3 /home/watcloud-slurm-ci/main.py" watcloud-slurm-ci \ No newline at end of file