From fa3ba8e8a3688a3fe7623752eb8ef6e0e373e91d Mon Sep 17 00:00:00 2001 From: Finn-Thorben Sell Date: Sun, 10 Sep 2023 18:58:51 +0200 Subject: [PATCH] add github ci to build containers --- .drone.yml | 112 ------------------- .github/workflows/build_all_containers.yml | 41 +++++++ .github/workflows/build_single_container.yml | 46 ++++++++ karaoke/Dockerfile | 2 +- limesurvey/Dockerfile | 2 +- sogo/Dockerfile | 2 +- 6 files changed, 90 insertions(+), 115 deletions(-) delete mode 100644 .drone.yml create mode 100644 .github/workflows/build_all_containers.yml create mode 100644 .github/workflows/build_single_container.yml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 78e71ca..0000000 --- a/.drone.yml +++ /dev/null @@ -1,112 +0,0 @@ ---- -kind: pipeline -type: kubernetes -name: base-buster -trigger: - branch: - - master - -steps: - - name: update container - image: plugins/docker - settings: - registry: registry.mafiasi.de - repo: registry.mafiasi.de/base-buster - username: agserver - password: - from_secret: REGISTRY_PW - context: base-buster - dockerfile: base-buster/Dockerfile - ---- -kind: pipeline -type: kubernetes -name: base-stretch -trigger: - branch: - - master - -steps: - - name: update container - image: plugins/docker - settings: - registry: registry.mafiasi.de - repo: registry.mafiasi.de/base-stretch - username: agserver - password: - from_secret: REGISTRY_PW - context: base-stretch - dockerfile: base-stretch/Dockerfile - ---- -kind: pipeline -type: kubernetes -name: nextcloud -trigger: - branch: - - master - -steps: - - name: update container - image: plugins/docker - settings: - registry: registry.mafiasi.de - repo: registry.mafiasi.de/nextcloud - username: agserver - password: - from_secret: REGISTRY_PW - context: nextcloud - dockerfile: nextcloud/Dockerfile - - name: restart deployment - image: registry.mafiasi.de/deployment_restarter - settings: - namespace: mafiasi-prod - name: mafiasi-cloud - ---- -kind: pipeline -type: kubernetes -name: collaboraoffice -trigger: - branch: - - master - -steps: - - name: update container - image: plugins/docker - settings: - registry: registry.mafiasi.de - repo: registry.mafiasi.de/collaboraoffice - username: agserver - password: - from_secret: REGISTRY_PW - context: collaboraoffice - dockerfile: collaboraoffice/Dockerfile - ---- -kind: pipeline -type: kubernetes -name: mattermost -trigger: - branch: - - master - -steps: - - name: update container - image: plugins/docker - settings: - registry: registry.mafiasi.de - repo: registry.mafiasi.de/mattermost - username: agserver - password: - from_secret: REGISTRY_PW - context: mattermost - dockerfile: mattermost/Dockerfile - tags: 5.26.2 - build_args: - - VERSION=5.26.2 - - name: restart deployment - image: registry.mafiasi.de/deployment_restarter - settings: - namespace: mafiasi-prod - name: mafiasi-mattermost diff --git a/.github/workflows/build_all_containers.yml b/.github/workflows/build_all_containers.yml new file mode 100644 index 0000000..d3e1857 --- /dev/null +++ b/.github/workflows/build_all_containers.yml @@ -0,0 +1,41 @@ +name: build all containers +on: + push: + branches: [ master, github_actions_ci ] + schedule: + - cron: "0 3 * * 1" # every monday + +permissions: + contents: read + packages: write + +jobs: + build_base_containers: + strategy: + fail-fast: true + matrix: + container: + - base-bullseye + - base-buster + uses: ./.github/workflows/build_single_container.yml + secrets: inherit + with: + container: ${{ matrix.container }} + + build_all_containers: + needs: [ build_base_containers ] + strategy: + fail-fast: false + matrix: + container: + - bitpoll + - etherpad + - gitea + - karma + - limesurvey + - nextcloud + - sogo + uses: ./.github/workflows/build_single_container.yml + secrets: inherit + with: + container: ${{ matrix.container }} diff --git a/.github/workflows/build_single_container.yml b/.github/workflows/build_single_container.yml new file mode 100644 index 0000000..e14ba94 --- /dev/null +++ b/.github/workflows/build_single_container.yml @@ -0,0 +1,46 @@ +name: build_single_container +on: + workflow_dispatch: + inputs: + container: + description: Which container to build + type: string + required: true + workflow_call: + inputs: + container: + description: Which container to build + type: string + required: true + +permissions: + contents: read + packages: write + +jobs: + build_container: + name: build ${{ inputs.container }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup docker buildx + uses: docker/setup-buildx-action@v2 + + - name: Build container + uses: docker/build-push-action@v4 + with: + context: ./${{ inputs.container }} + push: true + tags: ghcr.io/fsinfuhh/${{ inputs.container }}:latest + labels: | + org.opencontainers.image.title=${{ inputs.container }} + org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} diff --git a/karaoke/Dockerfile b/karaoke/Dockerfile index 44faf23..cc08c0f 100755 --- a/karaoke/Dockerfile +++ b/karaoke/Dockerfile @@ -1,4 +1,4 @@ -FROM registry.mafiasi.de/base-bullseye +FROM ghcr.io/fsinfuhh/base-bullseye RUN apt-get -y --no-install-recommends install g++ wget uwsgi uwsgi-plugin-python3 python3 python3-pip python3-six make python3-psycopg2 python3-ldap3 gettext gcc python3-dev libldap2-dev libsasl2-dev libldap-2.4-2 libsasl2-2 diff --git a/limesurvey/Dockerfile b/limesurvey/Dockerfile index 4050f7c..e49ba79 100644 --- a/limesurvey/Dockerfile +++ b/limesurvey/Dockerfile @@ -1,4 +1,4 @@ -FROM registry.mafiasi.de/base-bullseye +FROM ghcr.io/fsinfuhh/base-bullseye RUN apt install -y --no-install-recommends \ wget \ diff --git a/sogo/Dockerfile b/sogo/Dockerfile index d2614a0..56a7f90 100644 --- a/sogo/Dockerfile +++ b/sogo/Dockerfile @@ -1,4 +1,4 @@ -FROM registry.mafiasi.de/base-bullseye +FROM ghcr.io/fsinfuhh/base-bullseye ENV UID=2007 ENV VERSION=5.8.2