diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 05537b3..0000000 --- a/Dockerfile +++ /dev/null @@ -1,57 +0,0 @@ -FROM ubuntu:24.04 - -ARG RUNNER_VERSION="2.320.0" -ARG SPOTBUGS_VERSION="4.8.6" - -# Prevents installdependencies.sh from prompting the user and blocking the image creation -ARG DEBIAN_FRONTEND=noninteractive - -RUN apt update -y && apt upgrade -y && useradd -m docker - -RUN apt install -y --no-install-recommends \ -curl jq build-essential libssl-dev libffi-dev python3 python3-venv python3-dev python3-pip libicu-dev ant git-all - -# Install and configure UTF-8 locales -RUN apt-get update && apt-get install -y locales - -RUN sed -i -e 's/# es_ES.UTF-8 UTF-8/es_ES.UTF-8 UTF-8/' /etc/locale.gen \ - && locale-gen es_ES.UTF-8 - -ENV LANG='es_ES.UTF-8' LANGUAGE='es_ES:es' LC_ALL='es_ES.UTF-8' - -# Install PowerShell (needed for some actions) -# Install pre-requisite packages. -RUN apt-get update && apt-get install -y wget apt-transport-https software-properties-common - -# Download the Microsoft repository keys and install it -RUN wget -q https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb && dpkg -i packages-microsoft-prod.deb && rm packages-microsoft-prod.deb - -# Update the list of packages after we added packages.microsoft.com and install powershell -RUN apt-get update && apt-get install -y powershell - -RUN apt install -y ant maven git - -RUN mkdir -p /home/docker/actions-runner - -WORKDIR /home/docker/actions-runner - -# Download and extract SpotBugs -RUN curl -O -L https://github.com/spotbugs/spotbugs/releases/download/${SPOTBUGS_VERSION}/spotbugs-${SPOTBUGS_VERSION}.tgz && gunzip -c spotbugs-${SPOTBUGS_VERSION}.tgz | tar xvf - - -# Download and extract actions runner software -RUN curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \ -&& tar xzf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz - -RUN chown -R docker ~docker && /home/docker/actions-runner/bin/installdependencies.sh - -WORKDIR / - -COPY start.sh start.sh - -# make the script executable -RUN chmod +x start.sh - -# since the config and run script for actions are not allowed to be run by root, -# set the user to "docker" so all subsequent commands are run as the docker user -USER docker -ENTRYPOINT ["./start.sh"] \ No newline at end of file diff --git a/aw/Dockerfile b/aw/Dockerfile new file mode 100644 index 0000000..76e290d --- /dev/null +++ b/aw/Dockerfile @@ -0,0 +1,69 @@ +FROM nestybox/ubuntu-noble-systemd-docker + +ARG RUNNER_VERSION="2.322.0" + +# Prevents installdependencies.sh from prompting the user and blocking the image creation +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get install -y \ + curl \ + jq \ + sudo \ + unzip \ + wget \ + zip \ + git \ + && rm -rf /var/lib/apt/list/* + +# Add and config runner user as sudo +# Remove default admin user +# https://github.com/nestybox/dockerfiles/blob/master/ubuntu-focal-systemd/Dockerfile +RUN useradd -m runner \ + && usermod -aG sudo runner \ + && usermod -aG docker runner \ + && echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \ + && userdel -r admin + +RUN apt install -y --no-install-recommends \ +curl jq build-essential libssl-dev libffi-dev python3 python3-venv python3-dev python3-pip libicu-dev + +# Install and configure UTF-8 locales +RUN apt-get update && apt-get install -y locales + +RUN sed -i -e 's/# es_ES.UTF-8 UTF-8/es_ES.UTF-8 UTF-8/' /etc/locale.gen \ + && locale-gen es_ES.UTF-8 + +ENV LANG='es_ES.UTF-8' LANGUAGE='es_ES:es' LC_ALL='es_ES.UTF-8' + +# Install your software here # +############################## + +WORKDIR /runner + +# Download and extract actions runner software +RUN curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \ +&& tar xzf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz + +RUN ./bin/installdependencies.sh && rm -rf /var/lib/apt/lists/* + +# Copy AW scripts and install dependencies +COPY scripts_semantic_html scripts_semantic_html +RUN chown -R runner:runner scripts_semantic_html +RUN python3 -m venv .venv +ENV PATH=".venv/bin:$PATH" +RUN pip3 install -r scripts_semantic_html/requirements.txt + +# Just to support workflows from lab-03 +COPY aw-lab-03-script aw-lab-03-script +RUN chown -R runner:runner aw-lab-03-script + +WORKDIR / + +COPY start.sh /usr/local/bin/ + +# make the script executable +RUN chmod +x /usr/local/bin/start.sh + +USER runner + +ENTRYPOINT ["start.sh"] \ No newline at end of file diff --git a/aw/docker-compose.yml b/aw/docker-compose.yml new file mode 100644 index 0000000..d1b1220 --- /dev/null +++ b/aw/docker-compose.yml @@ -0,0 +1,16 @@ +services: + runner: + image: gh-actions-runner:base + runtime: sysbox-runc + restart: always + environment: + - ORG=ULE-Informatica-2024-2025 + - TOKEN= + - GROUP=AW + deploy: + mode: replicated + replicas: 2 + resources: + limits: + cpus: '1' + memory: 2G \ No newline at end of file diff --git a/aw/start.sh b/aw/start.sh new file mode 100644 index 0000000..3beb1b8 --- /dev/null +++ b/aw/start.sh @@ -0,0 +1,25 @@ +#! /bin/bash + +sudo service docker start + +ORG=$ORG + +ACCESS_TOKEN=$TOKEN + +GROUP=$GROUP + +REG_TOKEN=$(curl -X POST -H "Authorization: token ${ACCESS_TOKEN}" -H "Accept: application/vnd.github+json" https://api.github.com/orgs/${ORG}/actions/runners/registration-token | jq .token --raw-output) + +cd /runner + +./config.sh --url https://github.com/${ORG} --token ${REG_TOKEN} --runnergroup ${GROUP} + +cleanup() { + echo "Removing runner ..." + /config.sh remove --unattended --token ${REG_TOKEN} +} + +trap 'cleanup; exit 130' INT +trap 'cleanup; exit 143' TERM + +./run.sh & wait $! \ No newline at end of file diff --git a/legacy/Dockerfile b/legacy/Dockerfile new file mode 100644 index 0000000..7b65323 --- /dev/null +++ b/legacy/Dockerfile @@ -0,0 +1,58 @@ +FROM nestybox/ubuntu-noble-systemd-docker + +ARG RUNNER_VERSION="2.322.0" + +# Prevents installdependencies.sh from prompting the user and blocking the image creation +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get install -y \ + curl \ + jq \ + sudo \ + unzip \ + wget \ + zip \ + git \ + && rm -rf /var/lib/apt/list/* + +# Add and config runner user as sudo +# Remove default admin user +# https://github.com/nestybox/dockerfiles/blob/master/ubuntu-focal-systemd/Dockerfile +RUN useradd -m runner \ + && usermod -aG sudo runner \ + && usermod -aG docker runner \ + && echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \ + && userdel -r admin + +RUN apt install -y --no-install-recommends \ +curl jq build-essential libssl-dev libffi-dev python3 python3-venv python3-dev python3-pip libicu-dev + +# Install and configure UTF-8 locales +RUN apt-get update && apt-get install -y locales + +RUN sed -i -e 's/# es_ES.UTF-8 UTF-8/es_ES.UTF-8 UTF-8/' /etc/locale.gen \ + && locale-gen es_ES.UTF-8 + +ENV LANG='es_ES.UTF-8' LANGUAGE='es_ES:es' LC_ALL='es_ES.UTF-8' + +# Install your software here # +############################## + +WORKDIR /runner + +# Download and extract actions runner software +RUN curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \ +&& tar xzf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz + +RUN ./bin/installdependencies.sh && rm -rf /var/lib/apt/lists/* + +WORKDIR / + +COPY start.sh /usr/local/bin/ + +# make the script executable +RUN chmod +x /usr/local/bin/start.sh + +USER runner + +ENTRYPOINT ["start.sh"] \ No newline at end of file diff --git a/docker-compose.yml b/legacy/docker-compose.yml similarity index 100% rename from docker-compose.yml rename to legacy/docker-compose.yml diff --git a/start.sh b/legacy/start.sh similarity index 100% rename from start.sh rename to legacy/start.sh diff --git a/prg2/Dockerfile b/prg2/Dockerfile new file mode 100644 index 0000000..af3c947 --- /dev/null +++ b/prg2/Dockerfile @@ -0,0 +1,58 @@ +FROM nestybox/ubuntu-noble-systemd-docker + +ARG RUNNER_VERSION="2.328.0" + +# Prevents installdependencies.sh from prompting the user and blocking the image creation +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get install -y \ + curl \ + jq \ + sudo \ + unzip \ + wget \ + zip \ + git \ + && rm -rf /var/lib/apt/list/* + +# Add and config runner user as sudo +# Remove default admin user +# https://github.com/nestybox/dockerfiles/blob/master/ubuntu-focal-systemd/Dockerfile +RUN useradd -m runner \ + && usermod -aG sudo runner \ + && usermod -aG docker runner \ + && echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \ + && userdel -r admin + +RUN apt install -y --no-install-recommends \ +curl jq build-essential libssl-dev libffi-dev python3 python3-venv python3-dev python3-pip libicu-dev + +# Install and configure UTF-8 locales +RUN apt-get update && apt-get install -y locales + +RUN sed -i -e 's/# es_ES.UTF-8 UTF-8/es_ES.UTF-8 UTF-8/' /etc/locale.gen \ + && locale-gen es_ES.UTF-8 + +ENV LANG='es_ES.UTF-8' LANGUAGE='es_ES:es' LC_ALL='es_ES.UTF-8' + +# Install your software here # +############################## + +WORKDIR /runner + +# Download and extract actions runner software +RUN curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \ +&& tar xzf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz + +RUN ./bin/installdependencies.sh && rm -rf /var/lib/apt/lists/* + +WORKDIR / + +COPY start.sh /usr/local/bin/ + +# make the script executable +RUN chmod +x /usr/local/bin/start.sh + +USER runner + +ENTRYPOINT ["start.sh"] \ No newline at end of file diff --git a/prg2/docker-compose.yml b/prg2/docker-compose.yml new file mode 100644 index 0000000..38368a8 --- /dev/null +++ b/prg2/docker-compose.yml @@ -0,0 +1,16 @@ +services: + runner: + image: gh-actions-runner:base + runtime: sysbox-runc + restart: always + environment: + - ORG=ULE-Informatica-2025-2026 + - TOKEN= + - GROUP=PRG2 + deploy: + mode: replicated + replicas: 4 + resources: + limits: + cpus: '1' + memory: 2G \ No newline at end of file diff --git a/prg2/start.sh b/prg2/start.sh new file mode 100644 index 0000000..3beb1b8 --- /dev/null +++ b/prg2/start.sh @@ -0,0 +1,25 @@ +#! /bin/bash + +sudo service docker start + +ORG=$ORG + +ACCESS_TOKEN=$TOKEN + +GROUP=$GROUP + +REG_TOKEN=$(curl -X POST -H "Authorization: token ${ACCESS_TOKEN}" -H "Accept: application/vnd.github+json" https://api.github.com/orgs/${ORG}/actions/runners/registration-token | jq .token --raw-output) + +cd /runner + +./config.sh --url https://github.com/${ORG} --token ${REG_TOKEN} --runnergroup ${GROUP} + +cleanup() { + echo "Removing runner ..." + /config.sh remove --unattended --token ${REG_TOKEN} +} + +trap 'cleanup; exit 130' INT +trap 'cleanup; exit 143' TERM + +./run.sh & wait $! \ No newline at end of file diff --git a/spotbugs-4.8.6.tgz b/spotbugs-4.8.6.tgz deleted file mode 100644 index 4cd5bc0..0000000 Binary files a/spotbugs-4.8.6.tgz and /dev/null differ