diff --git a/Dockerfile b/Dockerfile index a355fd2..2e11302 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,8 @@ -FROM code.forgejo.org/forgejo/runner:5 AS runner -FROM debian:bullseye - -COPY --from=runner /bin/forgejo-runner /bin/forgejo-runner +FROM code.forgejo.org/forgejo/runner:5 USER root COPY ./entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh -# Install required packages -RUN apt-get update && \ - apt-get install -y sudo lxc lxc-templates uidmap && \ - apt-get clean - -# Configure user and permissions -RUN useradd -m runner && \ - echo "runner ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/runner && \ - chmod 0440 /etc/sudoers.d/runner && \ - mkdir /data && chown runner:runner /data - -# Enable subuid and subgid for unprivileged containers -RUN echo "runner:100000:65536" >> /etc/subuid && \ - echo "runner:100000:65536" >> /etc/subgid - -VOLUME [ "/data" ] - -WORKDIR /data - -ENTRYPOINT [ "/entrypoint.sh" ] +USER runner +ENTRYPOINT [ "/entrypoint.sh" ] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 5fa8191..8202a92 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,8 +22,6 @@ decho $PWD if [[ $(id -u) -eq 0 ]]; then ISROOT=true decho "[WARNING] Running as root user" -else - decho "[INFO] Running as non-root user: $(id -u)" fi # Handle if `command` is passed, as command appends arguments to the entrypoint @@ -32,24 +30,6 @@ if [ "$#" -gt 0 ]; then exit fi - -# LXC setup -if [[ "${LXC}" == "true" ]]; then - decho "Initializing LXC environment..." - lxc-checkconfig || { - echo "LXC environment is not correctly configured." >&2 - exit 1 - } - - if [[ ! -d /var/lib/lxc ]]; then - mkdir -p /var/lib/lxc - chown -R $(id -u):$(id -g) /var/lib/lxc - fi - - decho "LXC environment initialized." -fi - - # Handle and alter the config file if [[ -z "${CONFIG_FILE}" ]]; then echo "CONFIG_FILE is not set"