-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d558b0
commit 983bd45
Showing
6 changed files
with
117 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
USER=agustinbene | ||
REPO=back-access-control-gicom | ||
TOKEN=token | ||
|
||
|
||
#TOKEN:"Personal access tokens" | ||
# - repo | ||
# - workflow | ||
# - admin:org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,130 +1,6 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
.stylelintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
.temp | ||
.cache | ||
|
||
# Docusaurus cache and generated files | ||
.docusaurus | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
FROM ubuntu:20.04 as base | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update -y | ||
RUN apt-get install -y --no-install-recommends \ | ||
curl jq build-essential libssl-dev libffi-dev python3 python3-venv python3-dev python3-pip \ | ||
ca-certificates gnupg lsb-release libuser unzip | ||
|
||
# Setup Docker | ||
RUN mkdir -p /etc/apt/keyrings | ||
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg | ||
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null | ||
RUN apt-get update -y \ | ||
&& apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin | ||
|
||
# Install Docker Compose | ||
RUN curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \ | ||
&& chmod +x /usr/local/bin/docker-compose | ||
|
||
ARG DOCKERGID="995" | ||
RUN groupmod -g $DOCKERGID docker | ||
|
||
# Setup NodeJS | ||
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && apt-get install -y nodejs | ||
RUN npm install --global yarn | ||
|
||
# Setup action-runner | ||
ARG RUNNER_VERSION="2.313.0" | ||
|
||
RUN useradd -m runner -G docker | ||
WORKDIR /home/runner | ||
|
||
RUN mkdir -p actions-runner/_work .cache && cd actions-runner \ | ||
&& 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 runner:runner ~runner && ./actions-runner/bin/installdependencies.sh | ||
|
||
COPY start.sh start.sh | ||
RUN chmod +x start.sh | ||
|
||
RUN apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man /tmp/* | ||
|
||
USER runner | ||
|
||
# Extra configurations | ||
RUN yarn config set network-timeout 300000 | ||
|
||
ENTRYPOINT ["./start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,23 @@ | ||
# ga-runner-docker | ||
Github self-hosted runners in a Docker container | ||
|
||
Este repositorio proporciona runners autohospedados de GitHub en un contenedor Docker. | ||
|
||
**Nota:** Para utilizar este contenedor, es necesario generar un personal access token de GitHub con las siguientes propiedades: `repo`, `workflow` y `admin:org`. | ||
|
||
## Uso | ||
|
||
Para construir la imagen Docker, ejecuta el siguiente comando: | ||
|
||
```shell | ||
docker build -t gicom/ga-runner . | ||
``` | ||
|
||
Para levantar el servicio, puedes hacerlo de dos maneras: | ||
|
||
1. Utilizando Portainer: | ||
- Importa el archivo docker-compose.yml en Portainer y despliega el servicio. | ||
|
||
2. Utilizando Docker Stack: | ||
```shell | ||
docker stack deploy -c docker-compose.yml ga-runner-docker | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: "3.4" | ||
services: | ||
runner-ga-backend-access: | ||
image: gicom/ga-runner | ||
env_file: .env | ||
deploy: | ||
replicas: 1 | ||
placement: | ||
constraints: | ||
- node.role == manager | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
REPOSITORY=$USER/$REPO | ||
ACCESS_TOKEN=$TOKEN | ||
|
||
echo "REPO ${REPOSITORY}" | ||
echo "ACCESS_TOKEN ${ACCESS_TOKEN}" | ||
|
||
REG_TOKEN=$(curl -X POST -H "Authorization: token ${ACCESS_TOKEN}" -H "Accept: application/vnd.github+json" https://api.github.com/repos/${REPOSITORY}/actions/runners/registration-token | jq .token --raw-output) | ||
|
||
cd /home/runner/actions-runner | ||
|
||
./config.sh --url https://github.com/${REPOSITORY} --token ${REG_TOKEN} | ||
|
||
cleanup() { | ||
echo "Removing runner..." | ||
echo "REG_TOKEN ${REG_TOKEN}" | ||
./config.sh remove --token ${REG_TOKEN} | ||
} | ||
|
||
trap 'cleanup; exit 130' INT | ||
trap 'cleanup; exit 143' TERM | ||
|
||
./run.sh & wait $! |