diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..a3c2f95 --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +REPO=/ +TOKEN= +ACTIONS_RESULTS_URL=http://cache:3000/ \ No newline at end of file diff --git a/.github/workflows/github-ci.yml b/.github/workflows/github-ci.yml deleted file mode 100644 index 8374996..0000000 --- a/.github/workflows/github-ci.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Django CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v3 - with: - push: true - tags: dockerbeikeni/github-runner-02 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2eea525 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ec699a6..420f784 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,24 @@ -FROM ubuntu:20.04 +FROM ubuntu:24.04 -ARG RUNNER_VERSION="2.294.0" +ARG RUNNER_VERSION="2.322.0" # 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 + curl jq build-essential libssl-dev libffi-dev libicu-dev python3 python3-venv python3-dev python3-pip git unzip libasound2t64 pulseaudio +# playwright deps +RUN apt install -y libglib2.0-0t64 libnss3 libnspr4 libdbus-1-3 libatk1.0-0t64 libatk-bridge2.0-0t64 libcups2t64 libdrm2 libxcb1 libxkbcommon0 libatspi2.0-0t64 libx11-6 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 RUN cd /home/docker && mkdir actions-runner && 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 docker ~docker && /home/docker/actions-runner/bin/installdependencies.sh +RUN chown -R docker /home/docker && /home/docker/actions-runner/bin/installdependencies.sh + +RUN sed -i 's/\x41\x00\x43\x00\x54\x00\x49\x00\x4F\x00\x4E\x00\x53\x00\x5F\x00\x52\x00\x45\x00\x53\x00\x55\x00\x4C\x00\x54\x00\x53\x00\x5F\x00\x55\x00\x52\x00\x4C\x00/\x41\x00\x43\x00\x54\x00\x49\x00\x4F\x00\x4E\x00\x53\x00\x5F\x00\x52\x00\x45\x00\x53\x00\x55\x00\x4C\x00\x54\x00\x53\x00\x5F\x00\x4F\x00\x52\x00\x4C\x00/g' /home/docker/actions-runner/bin/Runner.Worker.dll COPY start.sh start.sh @@ -25,4 +29,14 @@ RUN chmod +x start.sh # set the user to "docker" so all subsequent commands are run as the docker user USER docker +ENV NODE_VERSION=22.13.0 +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash +ENV NVM_DIR=/home/docker/.nvm +RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} +RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION} +RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION} +ENV PATH="$NVM_DIR/versions/node/v${NODE_VERSION}/bin/:${PATH}" + +RUN npm install --global yarn + ENTRYPOINT ["./start.sh"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2508cd4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,34 @@ +services: + runner: + build: . + restart: unless-stopped + networks: + - backend + env_file: .env + volumes: + - /var/run/docker.sock:/var/run/docker.sock + deploy: + mode: replicated + replicas: 4 + resources: + reservations: + cpus: 0.5 + memory: 1024M + cache: + image: ghcr.io/falcondev-oss/github-actions-cache-server:latest + restart: unless-stopped + networks: + - backend + ports: + - '3000:3000' + environment: + API_BASE_URL: http://cache:3000 + volumes: + - cache:/app/.data + +volumes: + cache: + +networks: + backend: + external: false \ No newline at end of file