feat: add terragrunt
- add makefile for all builds - add .gitignore - add terragrunt dockerfile/nfpm
This commit is contained in:
commit
63c708183b
30
.gitea/workflows/build.yaml
Normal file
30
.gitea/workflows/build.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
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
|
||||
|
||||
- name: Show tree
|
||||
run: |
|
||||
tree /workspace
|
||||
26
.gitea/workflows/deploy.yaml
Normal file
26
.gitea/workflows/deploy.yaml
Normal file
@ -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
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
dist
|
||||
45
Makefile
Normal file
45
Makefile
Normal file
@ -0,0 +1,45 @@
|
||||
# Variables
|
||||
ROOT_DIR := $(PWD)
|
||||
RPMS_DIR := $(ROOT_DIR)/rpms
|
||||
NFPM_VERSION := 2.41.1
|
||||
|
||||
# Automatically find all package/version directories
|
||||
PACKAGES := $(shell find $(RPMS_DIR) -mindepth 2 -maxdepth 2 -type d | sed "s|$(RPMS_DIR)/||")
|
||||
|
||||
# Default target to build all packages and versions
|
||||
.PHONY: all
|
||||
all: $(PACKAGES)
|
||||
|
||||
# Build specific package/version
|
||||
.PHONY: $(PACKAGES)
|
||||
$(PACKAGES):
|
||||
@PACKAGE_NAME=$(shell echo $(@) | cut -d/ -f1) && \
|
||||
PACKAGE_VERSION=$(shell echo $(@) | cut -d/ -f2) && \
|
||||
echo "Building RPM for $$PACKAGE_NAME version $$PACKAGE_VERSION" && \
|
||||
$(MAKE) build PACKAGE_NAME=$$PACKAGE_NAME PACKAGE_VERSION=$$PACKAGE_VERSION
|
||||
|
||||
# Build target
|
||||
.PHONY: build
|
||||
build:
|
||||
@mkdir -p $(ROOT_DIR)/dist/$(PACKAGE_NAME)/
|
||||
@echo "Preparing to build $(PACKAGE_NAME) version $(PACKAGE_VERSION)"
|
||||
@cd $(RPMS_DIR)/$(PACKAGE_NAME) && \
|
||||
export PACKAGE_RELEASE=$$(cat $(PACKAGE_VERSION)/release) && \
|
||||
echo "Using PACKAGE_RELEASE=$${PACKAGE_RELEASE}" && \
|
||||
docker build \
|
||||
--build-arg NFPM_VERSION=$(NFPM_VERSION) \
|
||||
--build-arg PACKAGE_VERSION=$(PACKAGE_VERSION) \
|
||||
--build-arg PACKAGE_RELEASE=$${PACKAGE_RELEASE} \
|
||||
-t $$(echo $(PACKAGE_NAME)-builder \
|
||||
| tr '[:upper:]' '[:lower:]') . && \
|
||||
docker create --name $(PACKAGE_NAME)-$(PACKAGE_VERSION)-builder \
|
||||
$$(echo $(PACKAGE_NAME)-builder | tr '[:upper:]' '[:lower:]') && \
|
||||
docker start -a $(PACKAGE_NAME)-$(PACKAGE_VERSION)-builder && \
|
||||
docker cp $(PACKAGE_NAME)-$(PACKAGE_VERSION)-builder:/app/dist/. $(ROOT_DIR)/dist/$(PACKAGE_NAME)/ && \
|
||||
docker rm $(PACKAGE_NAME)-$(PACKAGE_VERSION)-builder
|
||||
|
||||
# Clean target
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo "Cleaning build artifacts..."
|
||||
rm -rf $(ROOT_DIR)/dist
|
||||
1
rpms/terragrunt/0.68.14/deploy
Normal file
1
rpms/terragrunt/0.68.14/deploy
Normal file
@ -0,0 +1 @@
|
||||
almalinux/el8
|
||||
1
rpms/terragrunt/0.68.14/release
Normal file
1
rpms/terragrunt/0.68.14/release
Normal file
@ -0,0 +1 @@
|
||||
1
|
||||
35
rpms/terragrunt/Dockerfile
Normal file
35
rpms/terragrunt/Dockerfile
Normal file
@ -0,0 +1,35 @@
|
||||
# Start with the AlmaLinux 8.10 base image
|
||||
FROM git.query.consul/unkin/almalinux8:latest
|
||||
|
||||
# Create output directory for RPMs
|
||||
RUN mkdir -p /app/dist
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
ARG PACKAGE_RELEASE
|
||||
ENV PACKAGE_RELEASE=${PACKAGE_RELEASE}
|
||||
ARG PACKAGE_VERSION
|
||||
ENV PACKAGE_VERSION=${PACKAGE_VERSION}
|
||||
ARG NFPM_VERSION
|
||||
ENV NFPM_VERSION=${NFPM_VERSION}
|
||||
|
||||
# Clean and update the repository cache
|
||||
RUN dnf clean all && \
|
||||
dnf makecache
|
||||
|
||||
# Install build tools and dependencies for building RPMs
|
||||
RUN dnf groupinstall -y 'Development Tools' && \
|
||||
dnf install -y make cmake gcc gcc-c++ rpm rpmdevtools wget tar gzip
|
||||
|
||||
# Install nfpm using the RPM package
|
||||
RUN dnf install -y https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/nfpm-${NFPM_VERSION}-1.x86_64.rpm
|
||||
|
||||
# Copy nfpm.yaml from the context into the container
|
||||
COPY nfpm.yaml /app/nfpm.yaml
|
||||
|
||||
# Download the required files
|
||||
RUN wget -O /app/terragrunt https://github.com/gruntwork-io/terragrunt/releases/download/v${PACKAGE_VERSION}/terragrunt_linux_amd64
|
||||
|
||||
# Default command to build RPMs
|
||||
CMD nfpm pkg --config /app/nfpm.yaml --target /app/dist --packager rpm
|
||||
35
rpms/terragrunt/nfpm.yaml
Normal file
35
rpms/terragrunt/nfpm.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
# nfpm.yaml
|
||||
|
||||
name: terragrunt
|
||||
version: ${PACKAGE_VERSION}
|
||||
release: ${PACKAGE_RELEASE}
|
||||
arch: amd64
|
||||
platform: linux
|
||||
section: default
|
||||
priority: extra
|
||||
description: "Terragrunt is a flexible orchestration tool that allows Infrastructure as Code written in OpenTofu/Terraform to scale."
|
||||
|
||||
maintainer: Ben Vincent <ben@unkin.net>
|
||||
homepage: https://github.com/gruntwork-io/terragrunt
|
||||
license: MIT
|
||||
|
||||
disable_globbing: false
|
||||
|
||||
replaces:
|
||||
- terragrunt
|
||||
|
||||
# Files to include in the package
|
||||
contents:
|
||||
- src: /app/terragrunt
|
||||
dst: /usr/local/bin/terragrunt
|
||||
file_info:
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
# Scripts to run during installation/removal (optional)
|
||||
# scripts:
|
||||
# preinstall: ./scripts/preinstall.sh
|
||||
# postinstall: ./scripts/postinstall.sh
|
||||
# preremove: ./scripts/preremove.sh
|
||||
# postremove: ./scripts/postremove.sh
|
||||
Loading…
Reference in New Issue
Block a user