From 4926c57c3041568003f7942a6d38312efb5445e4 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sun, 8 Sep 2024 01:59:22 +1000 Subject: [PATCH] feat: migrate to gitea actions - change from droneci to gitea actions - update Dockerfile cleanup stage --- .drone.yml | 53 ------------------------------------ .gitea/workflows/build.yaml | 26 ++++++++++++++++++ .gitea/workflows/deploy.yaml | 39 ++++++++++++++++++++++++++ Dockerfile | 6 ++-- README.md | 2 +- 5 files changed, 70 insertions(+), 56 deletions(-) delete mode 100644 .drone.yml create mode 100644 .gitea/workflows/build.yaml create mode 100644 .gitea/workflows/deploy.yaml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 7140305..0000000 --- a/.drone.yml +++ /dev/null @@ -1,53 +0,0 @@ -kind: pipeline -type: docker -name: build-docker-image - -steps: - - name: build - image: docker:dind - volumes: - - name: dockersock - path: /var/run/docker.sock - commands: - - apk add --no-cache make bash git - - make build - - - name: push - image: docker:dind - environment: - DOCKER_USERNAME: - from_secret: docker_username - DOCKER_PASSWORD: - from_secret: docker_password - volumes: - - name: dockersock - path: /var/run/docker.sock - when: - branch: - - master - event: - - push - - commands: - - apk add --no-cache make bash git - - echo "$DOCKER_PASSWORD" | docker login --username=$DOCKER_USERNAME --password-stdin git.query.consul - - make push - - - name: clean - image: docker:dind - volumes: - - name: dockersock - path: /var/run/docker.sock - commands: - - apk add --no-cache make bash git - - make clean - -volumes: - - name: dockersock - host: - path: /var/run/docker.sock - -trigger: - event: - - push - - pull_request diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..1ceda77 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,26 @@ +name: Build + +on: + pull_request: + +jobs: + build: + runs-on: almalinux-8 + container: + image: git.query.consul/unkin/almalinux8:latest + options: --privileged + + steps: + - name: Set up environment + run: | + dnf install -y yum-utils + yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo + dnf module enable -y nodejs:20 + dnf install -y docker-ce-cli make bash git nodejs + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Build Docker Image + run: | + make build diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..35160e3 --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,39 @@ +name: Deploy + +on: + push: + branches: + - master + +jobs: + build: + runs-on: almalinux-8 + container: + image: git.query.consul/unkin/almalinux8:latest + options: --privileged + + steps: + - name: Set up environment + run: | + dnf install -y yum-utils + yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo + dnf module enable -y nodejs:20 + dnf install -y docker-ce-cli make bash git nodejs + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Build Docker Image + run: | + make build + + - name: Log in to Docker + env: + UPLOAD_USER: ${{ secrets.UPLOAD_USER }} + UPLOAD_PASS: ${{ secrets.UPLOAD_PASS }} + run: | + echo "$UPLOAD_PASS" | docker login --username=$UPLOAD_USER --password-stdin git.query.consul + + - name: Push Docker Image + run: | + make push diff --git a/Dockerfile b/Dockerfile index 5b4c5e2..fe9da9f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,8 @@ RUN dnf clean all && \ # Update the system and install required packages RUN dnf update -y && \ - dnf install -y curl git && \ - dnf clean all && \ + dnf install -y curl git + +# Cleanup +RUN dnf clean all && \ rm -rf /var/cache/dnf diff --git a/README.md b/README.md index 6421613..f23885f 100644 --- a/README.md +++ b/README.md @@ -2,5 +2,5 @@ [![Build Status](https://droneci.query.consul/api/badges/unkin/docker-almalinux-base/status.svg)](https://droneci.query.consul/unkin/docker-almalinux-base) -This project provides a reproducible Docker image build process for `almalinux:8.10`, with custom YUM repository configurations and package installations. The build is automated using a `Makefile` and managed via Drone CI to ensure consistent and reliable Docker image builds. +This project provides a reproducible Docker image build process for `almalinux:8.10`, with custom YUM repository configurations and package installations. The build is automated using a `Makefile` and managed via CI tasks to ensure consistent and reliable Docker image builds.