feat: create base almalinux 8.10 image

- add drone.yml
- add makefile
- add Dockerfile
- add repos
This commit is contained in:
Ben Vincent 2024-08-25 17:01:50 +10:00
commit e8cc0ac6db
7 changed files with 100 additions and 0 deletions

25
.drone.yml Normal file
View File

@ -0,0 +1,25 @@
kind: pipeline
type: docker
name: build-docker-image
steps:
- name: build
image: docker:20.10.24-dind
environment:
DOCKER_HOST: tcp://localhost:2375 # Docker daemon
DOCKER_TLS_CERTDIR: '' # Disable TLS to simplify DIND setup
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- apk add --no-cache make bash git
- make build
volumes:
- name: dockersock
temp: {}
trigger:
event:
- push
- pull_request

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
# Start with the base AlmaLinux 8.10 image
FROM almalinux:8.10
# Remove existing repos and copy custom repo files into the container
RUN rm -rf /etc/yum.repos.d/*.repo
# Copy from the local context into the container
COPY files/*.repo /etc/yum.repos.d/
# Clean and update the repository cache
RUN dnf clean all && \
dnf makecache
# Update the system and install required packages
RUN dnf update -y && \
dnf install -y curl git && \
dnf clean all && \
rm -rf /var/cache/dnf

6
files/appstream.repo Normal file
View File

@ -0,0 +1,6 @@
[appstream]
name=appstream repository
baseurl=http://edgecache.query.consul/almalinux/8.10/AppStream/x86_64/os
gpgkey=http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-8
enabled=1
gpgcheck=1

6
files/baseos.repo Normal file
View File

@ -0,0 +1,6 @@
[baseos]
name=baseos repository
baseurl=http://edgecache.query.consul/almalinux/8.10/BaseOS/x86_64/os
gpgkey=http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-8
enabled=1
gpgcheck=1

6
files/epel.repo Normal file
View File

@ -0,0 +1,6 @@
[epel]
name=epel repository
baseurl=http://edgecache.query.consul/epel/8/Everything/x86_64
gpgkey=http://edgecache.query.consul/epel/RPM-GPG-KEY-EPEL-8
enabled=1
gpgcheck=1

6
files/powertools.repo Normal file
View File

@ -0,0 +1,6 @@
[powertools]
name=powertools repository
baseurl=http://edgecache.query.consul/almalinux/8.10/PowerTools/x86_64/os
gpgkey=http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-8
enabled=1
gpgcheck=1

33
makefile Normal file
View File

@ -0,0 +1,33 @@
# 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 := almalinux8
REGISTRY := git.query.consul
OWNER := unkin
# Build the Docker image (without tags)
build:
docker build --network=host -t $(IMAGE_NAME) .
# Tag the Docker image with the Git commit hash, the date, and 'latest'
tag:
docker tag $(IMAGE_NAME):latest $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(GIT_COMMIT)
docker tag $(IMAGE_NAME):latest $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(DATE_TAG)
docker tag $(IMAGE_NAME):latest $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):latest
# 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
# Clean up dangling Docker images
clean:
docker image prune -f
# Default target
default: build