Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu and Fedora #16

Merged
merged 10 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ on:
jobs:
build-base:
uses: ./.github/workflows/_build.yml
strategy:
matrix:
os: [ubuntu, fedora]
with:
image: ${{ github.actor }}/runner-krunvm-base
file: Dockerfile.base
image: ${{ github.actor }}/runner-krunvm-base-${{ matrix.os }}
file: Dockerfile.base.${{ matrix.os }}
secrets:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -19,11 +22,15 @@ jobs:
needs:
- build-base
uses: ./.github/workflows/_build.yml
strategy:
matrix:
os: [ubuntu, fedora]
with:
image: ${{ github.actor }}/runner-krunvm
image: ${{ github.actor }}/runner-krunvm-${{ matrix.os }}
file: Dockerfile
build-args: |
VERSION=${{ needs.build-base.outputs.version }}
DISTRO=${{ matrix.os }}
secrets:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
13 changes: 10 additions & 3 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ on:
jobs:
build-base:
uses: ./.github/workflows/_build.yml
strategy:
matrix:
os: [ubuntu, fedora]
with:
image: ${{ github.actor }}/runner-krunvm-base
file: Dockerfile.base
image: ${{ github.actor }}/runner-krunvm-base-${{ matrix.os }}
file: Dockerfile.base.${{ matrix.os }}
platforms: linux/amd64
secrets:
username: ${{ github.actor }}
Expand All @@ -20,12 +23,16 @@ jobs:
needs:
- build-base
uses: ./.github/workflows/_build.yml
strategy:
matrix:
os: [ubuntu, fedora]
with:
image: ${{ github.actor }}/runner-krunvm
image: ${{ github.actor }}/runner-krunvm-${{ matrix.os }}
file: Dockerfile
platforms: linux/amd64
build-args: |
VERSION=${{ needs.build-base.outputs.version }}
DISTRO=${{ matrix.os }}
secrets:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ jobs:
echo ""
echo "RUNNER_ variables"
env | grep RUNNER_
echo ""
echo "Docker Containers"
docker ps -a
docker run --rm hello-world
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# syntax=docker/dockerfile:1
ARG VERSION=main
FROM ghcr.io/efrecon/runner-krunvm-base:${VERSION}
ARG DISTRO=fedora
FROM ghcr.io/efrecon/runner-krunvm-base-${DISTRO}:${VERSION}

ARG INSTALL_VERSION=latest
ARG INSTALL_NAMESPACE=/opt/gh-runner-krunvm
Expand All @@ -9,7 +10,7 @@ COPY runner/*.sh ${INSTALL_NAMESPACE}/bin/
# Redundant, but this makes this image more standalone.
COPY lib/*.sh ${INSTALL_NAMESPACE}/lib/
RUN chmod a+x ${INSTALL_NAMESPACE}/bin/*.sh \
&& "${INSTALL_NAMESPACE}/bin/install.sh" -v -l /dev/stdout
&& "${INSTALL_NAMESPACE}/bin/install.sh" -v

ENTRYPOINT ["${INSTALL_NAMESPACE}/bin/entrypoint.sh"]
CMD ["./bin/Runner.Listener", "run", "--startuptype", "service"]
File renamed without changes.
11 changes: 11 additions & 0 deletions Dockerfile.base.ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# syntax=docker/dockerfile:1
ARG UBUNTU_VERSION=23.10
FROM ubuntu:${UBUNTU_VERSION}

ARG INSTALL_NAMESPACE=/opt/gh-runner-krunvm

COPY base/*.sh ${INSTALL_NAMESPACE}/bin/
COPY lib/*.sh ${INSTALL_NAMESPACE}/lib/
RUN chmod a+x "${INSTALL_NAMESPACE}/bin/base.sh" \
&& "${INSTALL_NAMESPACE}/bin/base.sh" -dv
COPY base/root/ /
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ This project creates [self-hosted][self] (ephemeral) GitHub [runners] based on
[runners] inside your infrastruture, as opposed to [solutions] based on
Kubernetes or Docker containers. MicroVMs boot fast, providing an experience
close to running containers. [krunvm] creates and starts VMs based on the
multi-platform OCI [images][image] created for this project.
multi-platform OCI images created for this project -- [ubuntu] (default) or
[fedora].

[self]: https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners
[runners]: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners
[krunvm]: https://github.com/containers/krunvm
[microVM]: https://github.com/infracloudio/awesome-microvm
[solutions]: https://github.com/jonico/awesome-runners
[image]: https://github.com/efrecon/gh-runner-krunvm/pkgs/container/runner-krunvm
[ubuntu]: https://github.com/efrecon/gh-runner-krunvm/pkgs/container/runner-krunvm-ubuntu
[fedora]: https://github.com/efrecon/gh-runner-krunvm/pkgs/container/runner-krunvm-fedora

## Example

Expand All @@ -33,7 +35,7 @@ the value of the token, nor the value of the runner registration token will be
visible to the workflows using your runners. The default is to create far-less
capable runners than the GitHub [runners], i.e. 1G or memory and 2 vCPUs. Unless
otherwise specified, runners have random names and carry labels with the name of
the base repository, e.g. `fedora` and `krunvm`. The GitHub runner
the base repository, e.g. `ubuntu` and `krunvm`. The GitHub runner
implementation will automatically add other labels in addition to those.

In the example above, the double-dash `--` separates options given to the
Expand Down Expand Up @@ -95,8 +97,6 @@ installed on the host. Installation is easiest on Fedora
## Limitations

+ Linux host installation easiest on Fedora
+ Runners are (also) based on Fedora. While standard images are based on Fedora,
running on top of ubuntu should also be possible.
+ Inside the runners: Docker not supported. Replaced by `podman` in [emulation]
mode.
+ Inside the runners: No support for docker network, containers run in "host"
Expand All @@ -117,11 +117,11 @@ will be created.

The OCI image is built in two parts:

+ The [base](./Dockerfile.base) image installs a minimal set of binaries and
+ The base images -- [fedora](./Dockerfile.base.fedora) and
[ubuntu](./Dockerfile.base.ubuntu) -- install a minimal set of binaries and
packages, both the ones necessary to execute the runner, but also a sane
minimal default for workflows. Regular GitHub [runners] have a wide number of
installed packages. The base image has much less. Also note that it is based
on Fedora, rather than Ubuntu.
installed packages. The base images have much less.
+ The [main](./Dockerfile) installs the runner binaries and scripts and creates
a directory structure that is used by the rest of the project.

Expand Down
Loading
Loading