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