-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add container dellnoantechnp/git-yq
- Loading branch information
1 parent
f9199f9
commit e8bb737
Showing
7 changed files
with
239 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
docker buildx create --name dellnoantechnp_builder --driver docker-container | ||
docker buildx use dellnoantechnp_builder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM --platform=$TARGETPLATFORM bitnami/git:2.44.0-debian-12-r0 | ||
LABEL org.opencontainers.image.source=https://github.com/dellnoantechnp/containers \ | ||
org.opencontainers.image.description="Devops tools container images." \ | ||
org.opencontainers.image.created="2024-04-09T01:20:00Z" \ | ||
org.opencontainers.image.title="git-yq" \ | ||
org.opencontainers.image.version="2.44.0" | ||
|
||
|
||
WORKDIR / | ||
ENV OS_ARCH="${TARGETARCH:-amd64}" \ | ||
OS_FLAVOUR="debian-12" \ | ||
OS_NAME="${TARGETOS:-linux}" | ||
|
||
COPY prebuildfs / | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
# Install required system packages and dependencies | ||
RUN install_packages file procps curl netcat-openbsd ca-certificates | ||
RUN install_packages jq wget | ||
RUN wget https://github.com/mikefarah/yq/releases/download/v4.43.1/yq_linux_${OS_ARCH} -O /usr/bin/yq &&\ | ||
chmod +x /usr/bin/yq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
COMMON_PARAMETERS="--platform linux/amd64,linux/arm64 --push --progress plain" | ||
|
||
docker buildx build -t dellnoantechnp/git-yq:2.44 ${COMMON_PARAMETERS} . | ||
|
||
docker buildx build -t dellnoantechnp/git-yq:git_2.44_yq_4.43_jq_1.6 ${COMMON_PARAMETERS} . | ||
|
||
docker buildx build -t dellnoantechnp/git-yq:latest ${COMMON_PARAMETERS} . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# shellcheck disable=SC1091 | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
# set -o xtrace # Uncomment this line for debugging purposes | ||
|
||
# Load libraries | ||
. /opt/scripts/liblog.sh | ||
. /opt/scripts/libbitnami.sh | ||
|
||
print_welcome_page | ||
|
||
echo "" | ||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
# | ||
# Canal-Server custom library | ||
|
||
# shellcheck disable=SC1091 | ||
|
||
# Load Generic Libraries | ||
. /opt/scripts/liblog.sh | ||
|
||
# Constants | ||
BOLD='\033[1m' | ||
|
||
# Functions | ||
|
||
######################## | ||
# Print the welcome page | ||
# Globals: | ||
# DISABLE_WELCOME_MESSAGE | ||
# APP_NAME | ||
# Arguments: | ||
# None | ||
# Returns: | ||
# None | ||
######################### | ||
print_welcome_page() { | ||
if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then | ||
if [[ -n "$APP_NAME" ]]; then | ||
print_image_welcome_page | ||
fi | ||
fi | ||
} | ||
|
||
######################## | ||
# Print the welcome page for a Canal-Server Docker image | ||
# Globals: | ||
# APP_NAME | ||
# Arguments: | ||
# None | ||
# Returns: | ||
# None | ||
######################### | ||
print_image_welcome_page() { | ||
local github_url="https://github.com/dellnoantechnp/containers" | ||
|
||
log "" | ||
log "${BOLD}Welcome to the ${APP_NAME} container${RESET}" | ||
log "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" | ||
log "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" | ||
log "" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#!/bin/bash | ||
# | ||
# Library for logging functions | ||
|
||
# Constants | ||
RESET='\033[0m' | ||
RED='\033[38;5;1m' | ||
GREEN='\033[38;5;2m' | ||
YELLOW='\033[38;5;3m' | ||
MAGENTA='\033[38;5;5m' | ||
CYAN='\033[38;5;6m' | ||
|
||
# Functions | ||
|
||
######################## | ||
# Print to STDERR | ||
# Arguments: | ||
# Message to print | ||
# Returns: | ||
# None | ||
######################### | ||
stderr_print() { | ||
# 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it | ||
local bool="${BITNAMI_QUIET:-false}" | ||
# comparison is performed without regard to the case of alphabetic characters | ||
shopt -s nocasematch | ||
if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then | ||
printf "%b\\n" "${*}" >&2 | ||
fi | ||
} | ||
|
||
######################## | ||
# Log message | ||
# Arguments: | ||
# Message to log | ||
# Returns: | ||
# None | ||
######################### | ||
log() { | ||
stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" | ||
} | ||
######################## | ||
# Log an 'info' message | ||
# Arguments: | ||
# Message to log | ||
# Returns: | ||
# None | ||
######################### | ||
info() { | ||
log "${GREEN}INFO ${RESET} ==> ${*}" | ||
} | ||
######################## | ||
# Log message | ||
# Arguments: | ||
# Message to log | ||
# Returns: | ||
# None | ||
######################### | ||
warn() { | ||
log "${YELLOW}WARN ${RESET} ==> ${*}" | ||
} | ||
######################## | ||
# Log an 'error' message | ||
# Arguments: | ||
# Message to log | ||
# Returns: | ||
# None | ||
######################### | ||
error() { | ||
log "${RED}ERROR${RESET} ==> ${*}" | ||
} | ||
######################## | ||
# Log a 'debug' message | ||
# Globals: | ||
# BITNAMI_DEBUG | ||
# Arguments: | ||
# None | ||
# Returns: | ||
# None | ||
######################### | ||
debug() { | ||
# 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it | ||
local bool="${BITNAMI_DEBUG:-false}" | ||
# comparison is performed without regard to the case of alphabetic characters | ||
shopt -s nocasematch | ||
if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then | ||
log "${MAGENTA}DEBUG${RESET} ==> ${*}" | ||
fi | ||
} | ||
|
||
######################## | ||
# Indent a string | ||
# Arguments: | ||
# $1 - string | ||
# $2 - number of indentation characters (default: 4) | ||
# $3 - indentation character (default: " ") | ||
# Returns: | ||
# None | ||
######################### | ||
indent() { | ||
local string="${1:-}" | ||
local num="${2:?missing num}" | ||
local char="${3:-" "}" | ||
# Build the indentation unit string | ||
local indent_unit="" | ||
for ((i = 0; i < num; i++)); do | ||
indent_unit="${indent_unit}${char}" | ||
done | ||
# shellcheck disable=SC2001 | ||
# Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions | ||
echo "$string" | sed "s/^/${indent_unit}/" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
n=0 | ||
max=2 | ||
export DEBIAN_FRONTEND=noninteractive | ||
|
||
until [ $n -gt $max ]; do | ||
set +e | ||
( | ||
apt-get update -qq && | ||
apt-get install -y --no-install-recommends "$@" | ||
) | ||
CODE=$? | ||
set -e | ||
if [ $CODE -eq 0 ]; then | ||
break | ||
fi | ||
if [ $n -eq $max ]; then | ||
exit $CODE | ||
fi | ||
echo "apt failed, retrying" | ||
n=$(($n + 1)) | ||
done | ||
apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives |