Add custom runner image with ansible, terraform, community.docker
This commit is contained in:
@@ -18,6 +18,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
ansible:
|
ansible:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container: git.lunarfront.tech/ryan/runner:latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: ansible
|
working-directory: ansible
|
||||||
@@ -26,11 +27,6 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Ansible
|
|
||||||
run: |
|
|
||||||
apt-get update -qq
|
|
||||||
apt-get install -y ansible
|
|
||||||
|
|
||||||
- name: Write SSH key
|
- name: Write SSH key
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
|
|||||||
27
.gitea/workflows/build-runner.yml
Normal file
27
.gitea/workflows/build-runner.yml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
name: Build Runner Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- 'runner/**'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Login to Gitea registry
|
||||||
|
run: echo "${{ secrets.GITEA_TOKEN }}" | docker login git.lunarfront.tech -u ryan --password-stdin
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
run: |
|
||||||
|
docker build -t git.lunarfront.tech/ryan/runner:latest runner/
|
||||||
|
docker push git.lunarfront.tech/ryan/runner:latest
|
||||||
|
|
||||||
|
- name: Logout
|
||||||
|
if: always()
|
||||||
|
run: docker logout git.lunarfront.tech
|
||||||
@@ -20,6 +20,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
terraform:
|
terraform:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container: git.lunarfront.tech/ryan/runner:latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: terraform
|
working-directory: terraform
|
||||||
@@ -28,9 +29,6 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Terraform
|
|
||||||
uses: hashicorp/setup-terraform@v3
|
|
||||||
|
|
||||||
- name: Terraform Init
|
- name: Terraform Init
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY }}
|
||||||
|
|||||||
24
runner/Dockerfile
Normal file
24
runner/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
ansible \
|
||||||
|
curl \
|
||||||
|
git \
|
||||||
|
gnupg \
|
||||||
|
openssh-client \
|
||||||
|
python3 \
|
||||||
|
python3-pip \
|
||||||
|
unzip \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Terraform
|
||||||
|
RUN curl -fsSL https://releases.hashicorp.com/terraform/1.10.5/terraform_1.10.5_linux_amd64.zip -o terraform.zip \
|
||||||
|
&& unzip terraform.zip -d /usr/local/bin \
|
||||||
|
&& rm terraform.zip
|
||||||
|
|
||||||
|
# Ansible collections
|
||||||
|
RUN ansible-galaxy collection install community.docker
|
||||||
|
|
||||||
|
RUN terraform --version && ansible --version
|
||||||
Reference in New Issue
Block a user