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

Add OCI containers #29

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
43 changes: 43 additions & 0 deletions .github/workflows/container-build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow builds and pushes the docker image for Cobbler-TFTP to "ghcr.io".

name: Create and publish a Docker image

on:
push:
branches: ['main']

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
# https://github.com/docker/login-action
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
# https://github.com/docker/build-push-action
uses: docker/build-push-action@v6
with:
context: .
file: docker/production/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 2 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ formats: all
python:
install:
- requirements: docs/requirements.rtd.txt
- method: pip
path: .
1 change: 1 addition & 0 deletions changelog.d/4.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add dockerfiles for image based deployments
30 changes: 30 additions & 0 deletions docker/develop/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# vim: ft=dockerfile

FROM opensuse/tumbleweed

Check warning on line 3 in docker/develop/Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docker/develop/Dockerfile#L3

Always tag the version of an image explicitly

# Define labels according to https://en.opensuse.org/Building_derived_containers
# labelprefix=org.opensuse.example
LABEL org.opencontainers.image.title="cobbler-tftp"
LABEL org.opencontainers.image.description="This image runs the (nearly) stateless Cobbler TFTP server."
LABEL org.opencontainers.image.version="dev.%RELEASE%"
LABEL org.opensuse.reference="registry.opensuse.org/systemsmanagement/cobbler/dev/cobbler-tftp:dev.%RELEASE%"
LABEL org.openbuildservice.disturl="%DISTURL%"
LABEL org.opencontainers.image.created="%BUILDTIME%"
# endlabelprefix

# ENV Variables we are using.
ENV container docker

# Custom repository
RUN zypper ar https://download.opensuse.org/repositories/systemsmanagement:/cobbler:/release34/openSUSE_Tumbleweed/ "Cobbler 3.4.x release project" \
&& zypper --gpg-auto-import-keys refresh

# Dependencies
RUN zypper in -y git \
python3-devel \
python3-pip \
&& zypper clean

WORKDIR /code
EXPOSE 69/UDP
CMD ["/code/docker/develop/entrypoint.sh"]
4 changes: 4 additions & 0 deletions docker/develop/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/bash

pip3 install --break-system-packages -e .
cobbler-tftp start --no-daemon
33 changes: 33 additions & 0 deletions docker/production/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# vim: ft=dockerfile
# Define the names/tags of the container
#!BuildTag: cobbler-test-github:release33 cobbler-test-github:release33.%RELEASE%

# We are using https://github.com/hadolint/hadolint to lint our Dockerfile.
# We don't want to version pin our dependencies for testing. Always retrieve what is up to date.
# hadolint global ignore=DL3037

FROM opensuse/leap:15.6

# Define labels according to https://en.opensuse.org/Building_derived_containers
# labelprefix=org.opensuse.example
LABEL org.opencontainers.image.title="cobbler-tftp"
LABEL org.opencontainers.image.description="This image runs the (nearly) stateless Cobbler TFTP server."
LABEL org.opencontainers.image.version="release34.%RELEASE%"
LABEL org.opensuse.reference="registry.opensuse.org/systemsmanagement/cobbler/release34/cobbler-tftp:release34.%RELEASE%"
LABEL org.openbuildservice.disturl="%DISTURL%"
LABEL org.opencontainers.image.created="%BUILDTIME%"
# endlabelprefix

# ENV Variables we are using.
ENV container docker

# Custom repository
RUN zypper ar https://download.opensuse.org/repositories/systemsmanagement:/cobbler:/release34/15.6/ "Cobbler 3.4.x release project" \
&& zypper --gpg-auto-import-keys refresh

# Dev Dependencies
RUN zypper in -y cobbler-tftp \
&& zypper clean

EXPOSE 69/UDP
CMD ["cobbler-tftp", "--no-daemon"]
33 changes: 33 additions & 0 deletions docker/rolling/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# vim: ft=dockerfile
# Define the names/tags of the container
#!BuildTag: cobbler-test-github:release33 cobbler-test-github:release33.%RELEASE%

# We are using https://github.com/hadolint/hadolint to lint our Dockerfile.
# We don't want to version pin our dependencies for testing. Always retrieve what is up to date.
# hadolint global ignore=DL3037

FROM opensuse/tumbleweed:latest

Check warning on line 9 in docker/rolling/Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docker/rolling/Dockerfile#L9

Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag

# Define labels according to https://en.opensuse.org/Building_derived_containers
# labelprefix=org.opensuse.example
LABEL org.opencontainers.image.title="cobbler-tftp"
LABEL org.opencontainers.image.description="This image runs the (nearly) stateless Cobbler TFTP server."
LABEL org.opencontainers.image.version="rolling.%RELEASE%"
LABEL org.opensuse.reference="registry.opensuse.org/systemsmanagement/cobbler/containers/cobbler-tftp:rolling.%RELEASE%"
LABEL org.openbuildservice.disturl="%DISTURL%"
LABEL org.opencontainers.image.created="%BUILDTIME%"
# endlabelprefix

# ENV Variables we are using.
ENV container docker

# Custom repository
RUN zypper ar https://download.opensuse.org/repositories/systemsmanagement:/cobbler:/release34/openSUSE_Tumbleweed/ "Cobbler 3.4.x release project" \
&& zypper --gpg-auto-import-keys refresh

# Dependencies
RUN zypper in -y cobbler-tftp \
&& zypper clean

EXPOSE 69/UDP
CMD ["cobbler-tftp", "start", "--no-daemon"]
Loading