Compare commits

..

1 Commits

Author SHA1 Message Date
unkinben e2d7bca962 feat: initial commit
build-docker-image / push (pull_request) Has been skipped
build-docker-image / clean (pull_request) Failing after 12s
build-docker-image / build (pull_request) Failing after 14s
- add Makefile
- add gitea workflows
- add Dockerfile
2024-09-08 00:48:49 +10:00
5 changed files with 75 additions and 92 deletions
+48 -4
View File
@@ -1,19 +1,63 @@
name: Build
name: build-docker-image
on:
push:
branches:
- master
pull_request:
branches:
- '*'
jobs:
build:
runs-on: almalinux-8
container:
image: git.query.consul/unkin/almalinux8-runnerdnd:latest
image: docker:dind
options: --privileged
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up environment
run: |
apk add --no-cache make bash git
- name: Build Docker Image
run: |
make build
push:
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
runs-on: almalinux-8
container:
image: docker:dind
options: --privileged
steps:
- name: Set up environment
run: |
apk add --no-cache make bash git
- 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
clean:
runs-on: almalinux-8
container:
image: docker:dind
options: --privileged
steps:
- name: Set up environment
run: |
apk add --no-cache make bash git
- name: Clean Up
run: |
make clean
-32
View File
@@ -1,32 +0,0 @@
name: Deploy
on:
push:
branches:
- master
jobs:
build:
runs-on: almalinux-8
container:
image: git.query.consul/unkin/almalinux8-runnerdnd:latest
options: --privileged
steps:
- 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
+7 -5
View File
@@ -1,15 +1,17 @@
# Start with the AlmaLinux 8.10 base image
FROM git.query.consul/unkin/almalinux8:latest
# Clean and update the repository cache
RUN dnf clean all && \
dnf makecache
# Install nodejs:20 for actions
RUN dnf module enable -y nodejs:20 && \
dnf install -y nodejs
# Install build tools and dependencies for building RPMs
RUN dnf clean all && \
dnf makecache && \
dnf groupinstall -y 'Development Tools' && \
dnf install -y make cmake gcc gcc-c++ rpm rpmdevtools wget tar gzip go nfpm terragrunt terraform
# Install build-essential
RUN dnf groupinstall -y 'Development Tools' && \
dnf install -y make cmake gcc gcc-c++ rpm rpmdevtools wget
# Cleanup
RUN dnf clean all && \
+20 -35
View File
@@ -1,48 +1,33 @@
# Variables
# Get the current Git commit hash
GIT_COMMIT := $(shell git rev-parse --short HEAD)
# Get the current date in YYYYMMDD format
DATE_TAG := $(shell date +%Y%m%d)
# Set the Docker image name and repository information
IMAGE_NAME := alma8-buildagent
REGISTRY := git.query.consul
OWNER := unkin
# List of releases (directories under ./release)
RELEASES := $(shell find release -mindepth 1 -maxdepth 1 -type d -exec basename {} \;)
# Build the Docker image (without tags)
build:
docker build --network=host -t $(REGISTRY)/$(OWNER)/$(IMAGE_NAME) .
# Build all releases
build: $(addprefix build-,$(RELEASES))
# Tag the Docker image with the Git commit hash, the date, and 'latest'
tag:
docker tag $(REGISTRY)/$(OWNER)/$(IMAGE_NAME) $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(GIT_COMMIT)
docker tag $(REGISTRY)/$(OWNER)/$(IMAGE_NAME) $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(DATE_TAG)
docker tag $(REGISTRY)/$(OWNER)/$(IMAGE_NAME) $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):latest
# Tag all releases
tag: $(addprefix tag-,$(RELEASES))
# Push the Docker image to a repository with all tags
push: tag
docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(GIT_COMMIT)
docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(DATE_TAG)
docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):latest
# Push all releases
push: $(addprefix push-,$(RELEASES))
# Clean dangling images
# Clean up dangling Docker images
clean:
docker image prune -f
# List all available releases
list:
@echo "Available releases:"
@echo $(RELEASES) | tr ' ' '\n'
# Build a specific release
build-%:
$(info Building almalinux$*-buildagent Docker image)
docker build --network=host -t $(REGISTRY)/$(OWNER)/almalinux$*-buildagent -f release/$*/Dockerfile release/$*
# Tag a specific release
tag-%:
$(info Tagging almalinux$*-buildagent Docker image)
docker tag $(REGISTRY)/$(OWNER)/almalinux$*-buildagent $(REGISTRY)/$(OWNER)/almalinux$*-buildagent:$(GIT_COMMIT)
docker tag $(REGISTRY)/$(OWNER)/almalinux$*-buildagent $(REGISTRY)/$(OWNER)/almalinux$*-buildagent:$(DATE_TAG)
docker tag $(REGISTRY)/$(OWNER)/almalinux$*-buildagent $(REGISTRY)/$(OWNER)/almalinux$*-buildagent:latest
# Push a specific release
push-%: tag-%
$(info Pushing almalinux$*-buildagent Docker image)
docker push $(REGISTRY)/$(OWNER)/almalinux$*-buildagent:$(GIT_COMMIT)
docker push $(REGISTRY)/$(OWNER)/almalinux$*-buildagent:$(DATE_TAG)
docker push $(REGISTRY)/$(OWNER)/almalinux$*-buildagent:latest
# Default target
default: build
-16
View File
@@ -1,16 +0,0 @@
# Start with the AlmaLinux 9 base image
FROM git.query.consul/unkin/almalinux9:latest
# Install nodejs:20 for actions
RUN dnf module enable -y nodejs:20 && \
dnf install -y nodejs
# Install build tools and dependencies for building RPMs
RUN dnf clean all && \
dnf makecache && \
dnf groupinstall -y 'Development Tools' && \
dnf install -y make cmake gcc gcc-c++ rpm rpmdevtools wget tar gzip go nfpm terragrunt terraform
# Cleanup
RUN dnf clean all && \
rm -rf /var/cache/dnf