fix: reorganize Dockerfile user context and dependency installation

- Move WORKDIR before USER directive to follow Docker best practices
- Run installdependencies.sh as root user with explicit USER root context
- Reorder ENTRYPOINT to the end of the Dockerfile
- Remove unnecessary sudo prefix since running as root
This commit is contained in:
Junya Morioka
2025-12-11 02:27:49 +09:00
parent ab165f3f22
commit 2e6095a575
+10 -4
View File
@@ -54,12 +54,18 @@ RUN echo '%sudo ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
USER ubuntu
WORKDIR /home/ubuntu
USER ubuntu
RUN curl -fsSL -o actions-runner.tar.gz -L "https://github.com/actions/runner/releases/download/v${GH_RUNNER_VERSION}/actions-runner-linux-${TARGET_ARCH}-${GH_RUNNER_VERSION}.tar.gz" \
&& tar xf actions-runner.tar.gz \
&& rm actions-runner.tar.gz \
&& sudo ./bin/installdependencies.sh
&& rm actions-runner.tar.gz
USER root
RUN ./bin/installdependencies.sh
USER ubuntu
ENTRYPOINT ["/entrypoint.sh"]