Skip to content

Commit

Permalink
Merge pull request #1 from chaddyc/feature/multi-build-containers
Browse files Browse the repository at this point in the history
container configs and builds
  • Loading branch information
chaddyc authored Dec 1, 2024
2 parents 1430f8c + 78a8f4f commit 63dc844
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 33 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @chaddyc
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2

updates:
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "main"
schedule:
interval: "monthly"
groups:
gha-dependabot:
update-types:
- "minor"
- "patch"
- "major"
28 changes: 28 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Description
Provide a brief summary of the changes in this PR, including the problem being solved or the feature being added.

## Changes
Select the type of change made in this PR:
- [ ] New Feature 🚀
- [ ] Bug Fix 🐛
- [ ] Documentation Update 📝
- [ ] CI/CD Update ⚙️

## How to Test
1. Describe the steps to test the changes.
2. Include any special setup, commands, or test cases.

## Checklist
- [ ] Code has been linted and formatted.
- [ ] Tests have been added or updated (if applicable).
- [ ] Documentation has been updated (if needed).
- [ ] The code follows the style and conventions of this repository.

## Related Issues
Fixes # (link the issue this PR addresses, if applicable).

## Screenshots (if applicable)
Add screenshots or screen recordings to demonstrate UI/UX changes.

## Additional Notes
Include any additional information or context here.
66 changes: 66 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Docker Build

on:
push:
branches:
- main

jobs:
docker-build:
if: ${{ github.ref == 'refs/heads/main' && contains('["chaddyc"]', github.actor) }}
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ github.token }}
REPO: ${{ github.event.repository.name }}
steps:
- name: Checkout code
uses: actions/checkout@4

- name: Set up QEM
uses: docker/setup-qemu-action@3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push ubuntu latest
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
build-arg: UBUNTU_VERSION=latest
push: true
tags: chaddyc/${{ github.event.repository.name }}:latest

- name: Build and push ubuntu 24.04
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
build-arg: UBUNTU_VERSION=24.04
push: true
tags: chaddyc/${{ github.event.repository.name }}:24.04

- name: Build and push ubuntu 22.04
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
build-arg: UBUNTU_VERSION=22.04
push: true
tags: chaddyc/${{ github.event.repository.name }}:22.04



# - name: Update docker readme description
# uses: peter-evans/dockerhub-description@v3
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# repository: chaddyc/${{ github.event.repository.name }}

3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM ubuntu:24.04
ARG UBUNTU_VERSION=20.04
FROM ubuntu:${UBUNTU_VERSION}

ENV DEBIAN_FRONTEND=noninteractive

Expand Down
33 changes: 1 addition & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,3 @@
# gha-runner-docker
GitHub Actions Runner Docker Container
# gha-runner

docker run -e GITHUB_URL=https://github.com/<your-org-or-repo> \
-e RUNNER_TOKEN=<your-runner-token> \
--name <container-name>
github-runner

# GitHub Actions Runner with Docker

This guide provides instructions for setting up a self-hosted GitHub Actions Runner using Docker. You can run the container with either `docker run` or `docker-compose`.

---

## Prerequisites

1. **Install Docker**
Ensure Docker is installed and running on your system. Follow the [official installation guide](https://docs.docker.com/get-docker/) if needed.

2. **Install Docker Compose (Optional)**
If using `docker-compose`, ensure it is installed. You can follow the [official guide](https://docs.docker.com/compose/install/) to set it up.

3. **Generate a Runner Token**
- Go to your GitHub repository or organization.
- Navigate to **Settings > Actions > Runners**.
- Click **Add Runner** and copy the registration token provided.

---

## Using `docker run`

1. **Build the Docker Image**
```bash
docker build -t github-runner .

0 comments on commit 63dc844

Please sign in to comment.