Skip to content

Commit 709a03e

Browse files
committed
Added dockerfile etc from Bitnami
Signed-off-by: Marcus Noble <[email protected]>
1 parent c1e3da1 commit 709a03e

36 files changed

+5207
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
tags: [ 'v*.*.*' ]
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
id-token: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
# Install the cosign tool except on PR
26+
# https://github.com/sigstore/cosign-installer
27+
- name: Install cosign
28+
if: github.event_name != 'pull_request'
29+
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
30+
with:
31+
cosign-release: 'v2.2.4'
32+
33+
# Set up BuildKit Docker container builder to be able to build
34+
# multi-platform images and export cache
35+
# https://github.com/docker/setup-buildx-action
36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
38+
39+
# Login against a Docker registry except on PR
40+
# https://github.com/docker/login-action
41+
- name: Log into registry ${{ env.REGISTRY }}
42+
if: github.event_name != 'pull_request'
43+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
44+
with:
45+
registry: ${{ env.REGISTRY }}
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
49+
# Extract metadata (tags, labels) for Docker
50+
# https://github.com/docker/metadata-action
51+
- name: Extract Docker metadata
52+
id: meta
53+
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
54+
with:
55+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
56+
57+
# Build and push Docker image with Buildx (don't push on PR)
58+
# https://github.com/docker/build-push-action
59+
- name: Build and push Docker image
60+
id: build-and-push
61+
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
62+
with:
63+
context: .
64+
push: ${{ github.event_name != 'pull_request' }}
65+
tags: ${{ steps.meta.outputs.tags }}
66+
labels: ${{ steps.meta.outputs.labels }}
67+
cache-from: type=gha
68+
cache-to: type=gha,mode=max
69+
70+
# Sign the resulting Docker image digest except on PRs.
71+
# This will only write to the public Rekor transparency log when the Docker
72+
# repository is public to avoid leaking data. If you would like to publish
73+
# transparency data even for private images, pass --force to cosign below.
74+
# https://github.com/sigstore/cosign
75+
- name: Sign the published Docker image
76+
if: ${{ github.event_name != 'pull_request' }}
77+
env:
78+
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
79+
TAGS: ${{ steps.meta.outputs.tags }}
80+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
81+
# This step uses the identity token to provision an ephemeral certificate
82+
# against the sigstore community Fulcio instance.
83+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

Dockerfile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copyright Broadcom, Inc. All Rights Reserved.
2+
# SPDX-License-Identifier: APACHE-2.0
3+
4+
FROM docker.io/bitnami/minideb:bookworm
5+
6+
ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith"
7+
ARG TARGETARCH
8+
9+
LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \
10+
org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \
11+
org.opencontainers.image.created="2025-08-18T11:35:17Z" \
12+
org.opencontainers.image.description="Application packaged by Broadcom, Inc." \
13+
org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/ghost/README.md" \
14+
org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/ghost" \
15+
org.opencontainers.image.title="ghost" \
16+
org.opencontainers.image.vendor="Broadcom, Inc." \
17+
org.opencontainers.image.version="6.0.4"
18+
19+
ENV HOME="/" \
20+
OS_ARCH="${TARGETARCH:-amd64}" \
21+
OS_FLAVOUR="debian-12" \
22+
OS_NAME="linux"
23+
24+
COPY prebuildfs /
25+
SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"]
26+
# Install required system packages and dependencies
27+
RUN install_packages acl ca-certificates curl jq libaudit1 libbz2-1.0 libcap-ng0 libcom-err2 libcrypt1 libffi8 libgcc-s1 libgssapi-krb5-2 libicu72 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 liblzma5 libncurses6 libncursesw6 libnsl2 libpam0g libreadline8 libsqlite3-0 libssl3 libstdc++6 libtinfo6 libtirpc3 libxml2 procps zlib1g
28+
RUN --mount=type=secret,id=downloads_url,env=SECRET_DOWNLOADS_URL \
29+
DOWNLOADS_URL=${SECRET_DOWNLOADS_URL:-${DOWNLOADS_URL}} ; \
30+
mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ || exit 1 ; \
31+
COMPONENTS=( \
32+
"python-3.12.11-9-linux-${OS_ARCH}-debian-12" \
33+
"node-22.18.0-0-linux-${OS_ARCH}-debian-12" \
34+
"mysql-client-12.0.2-0-linux-${OS_ARCH}-debian-12" \
35+
"ghost-6.0.4-0-linux-${OS_ARCH}-debian-12" \
36+
) ; \
37+
for COMPONENT in "${COMPONENTS[@]}"; do \
38+
if [ ! -f "${COMPONENT}.tar.gz" ]; then \
39+
curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \
40+
curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \
41+
fi ; \
42+
sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \
43+
tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner ; \
44+
rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \
45+
done
46+
RUN apt-get update && apt-get upgrade -y && \
47+
apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives
48+
RUN chmod g+rwX /opt/bitnami
49+
RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true
50+
51+
COPY rootfs /
52+
RUN /opt/bitnami/scripts/ghost/postunpack.sh
53+
RUN /opt/bitnami/scripts/mysql-client/postunpack.sh
54+
ENV APP_VERSION="6.0.4" \
55+
BITNAMI_APP_NAME="ghost" \
56+
PATH="/opt/bitnami/python/bin:/opt/bitnami/node/bin:/opt/bitnami/mysql/bin:/opt/bitnami/ghost/bin:$PATH"
57+
58+
EXPOSE 2368 3000
59+
60+
WORKDIR /opt/bitnami/ghost
61+
USER 1001
62+
ENTRYPOINT [ "/opt/bitnami/scripts/ghost/entrypoint.sh" ]
63+
CMD [ "/opt/bitnami/scripts/ghost/run.sh" ]

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
# ghost-container
2+
23
Fork of the Bitnami Ghost container image
4+
5+
---
6+
7+
Pinned at the latest, at time of commit, version available for this container image.
8+
9+
This is then available from GHCR as: `ghcr.io/namelessplanet/ghost-container:6.0.4-debian-12-r1`
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"ghost": {
3+
"arch": "amd64",
4+
"distro": "debian-12",
5+
"type": "NAMI",
6+
"version": "6.0.4-0"
7+
},
8+
"mysql-client": {
9+
"arch": "amd64",
10+
"distro": "debian-12",
11+
"type": "NAMI",
12+
"version": "12.0.2-0"
13+
},
14+
"node": {
15+
"arch": "amd64",
16+
"distro": "debian-12",
17+
"type": "NAMI",
18+
"version": "22.18.0-0"
19+
},
20+
"python": {
21+
"arch": "amd64",
22+
"distro": "debian-12",
23+
"type": "NAMI",
24+
"version": "3.12.11-9"
25+
}
26+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Bitnami containers ship with software bundles. You can find the licenses under:
2+
/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
# Copyright Broadcom, Inc. All Rights Reserved.
3+
# SPDX-License-Identifier: APACHE-2.0
4+
#
5+
# Bitnami custom library
6+
7+
# shellcheck disable=SC1091
8+
9+
# Load Generic Libraries
10+
. /opt/bitnami/scripts/liblog.sh
11+
12+
# Constants
13+
BOLD='\033[1m'
14+
15+
# Functions
16+
17+
########################
18+
# Print the welcome page
19+
# Globals:
20+
# DISABLE_WELCOME_MESSAGE
21+
# BITNAMI_APP_NAME
22+
# Arguments:
23+
# None
24+
# Returns:
25+
# None
26+
#########################
27+
print_welcome_page() {
28+
if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then
29+
if [[ -n "$BITNAMI_APP_NAME" ]]; then
30+
print_image_welcome_page
31+
fi
32+
fi
33+
}
34+
35+
########################
36+
# Print the welcome page for a Bitnami Docker image
37+
# Globals:
38+
# BITNAMI_APP_NAME
39+
# Arguments:
40+
# None
41+
# Returns:
42+
# None
43+
#########################
44+
print_image_welcome_page() {
45+
local github_url="https://github.com/bitnami/containers"
46+
47+
info ""
48+
info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}"
49+
info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}"
50+
info "${YELLOW}NOTICE: Starting August 28th, 2025, only a limited subset of images/charts will remain available for free. Backup will be available for some time at the 'Bitnami Legacy' repository. More info at https://github.com/bitnami/containers/issues/83267${RESET}"
51+
info ""
52+
}
53+
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
#!/bin/bash
2+
# Copyright Broadcom, Inc. All Rights Reserved.
3+
# SPDX-License-Identifier: APACHE-2.0
4+
#
5+
# Library for managing files
6+
7+
# shellcheck disable=SC1091
8+
9+
# Load Generic Libraries
10+
. /opt/bitnami/scripts/libos.sh
11+
12+
# Functions
13+
14+
########################
15+
# Replace a regex-matching string in a file
16+
# Arguments:
17+
# $1 - filename
18+
# $2 - match regex
19+
# $3 - substitute regex
20+
# $4 - use POSIX regex. Default: true
21+
# Returns:
22+
# None
23+
#########################
24+
replace_in_file() {
25+
local filename="${1:?filename is required}"
26+
local match_regex="${2:?match regex is required}"
27+
local substitute_regex="${3:?substitute regex is required}"
28+
local posix_regex=${4:-true}
29+
30+
local result
31+
32+
# We should avoid using 'sed in-place' substitutions
33+
# 1) They are not compatible with files mounted from ConfigMap(s)
34+
# 2) We found incompatibility issues with Debian10 and "in-place" substitutions
35+
local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues
36+
if [[ $posix_regex = true ]]; then
37+
result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")"
38+
else
39+
result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")"
40+
fi
41+
echo "$result" > "$filename"
42+
}
43+
44+
########################
45+
# Replace a regex-matching multiline string in a file
46+
# Arguments:
47+
# $1 - filename
48+
# $2 - match regex
49+
# $3 - substitute regex
50+
# Returns:
51+
# None
52+
#########################
53+
replace_in_file_multiline() {
54+
local filename="${1:?filename is required}"
55+
local match_regex="${2:?match regex is required}"
56+
local substitute_regex="${3:?substitute regex is required}"
57+
58+
local result
59+
local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues
60+
result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")"
61+
echo "$result" > "$filename"
62+
}
63+
64+
########################
65+
# Remove a line in a file based on a regex
66+
# Arguments:
67+
# $1 - filename
68+
# $2 - match regex
69+
# $3 - use POSIX regex. Default: true
70+
# Returns:
71+
# None
72+
#########################
73+
remove_in_file() {
74+
local filename="${1:?filename is required}"
75+
local match_regex="${2:?match regex is required}"
76+
local posix_regex=${3:-true}
77+
local result
78+
79+
# We should avoid using 'sed in-place' substitutions
80+
# 1) They are not compatible with files mounted from ConfigMap(s)
81+
# 2) We found incompatibility issues with Debian10 and "in-place" substitutions
82+
if [[ $posix_regex = true ]]; then
83+
result="$(sed -E "/$match_regex/d" "$filename")"
84+
else
85+
result="$(sed "/$match_regex/d" "$filename")"
86+
fi
87+
echo "$result" > "$filename"
88+
}
89+
90+
########################
91+
# Appends text after the last line matching a pattern
92+
# Arguments:
93+
# $1 - file
94+
# $2 - match regex
95+
# $3 - contents to add
96+
# Returns:
97+
# None
98+
#########################
99+
append_file_after_last_match() {
100+
local file="${1:?missing file}"
101+
local match_regex="${2:?missing pattern}"
102+
local value="${3:?missing value}"
103+
104+
# We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again
105+
result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)"
106+
echo "$result" > "$file"
107+
}
108+
109+
########################
110+
# Wait until certain entry is present in a log file
111+
# Arguments:
112+
# $1 - entry to look for
113+
# $2 - log file
114+
# $3 - max retries. Default: 12
115+
# $4 - sleep between retries (in seconds). Default: 5
116+
# Returns:
117+
# Boolean
118+
#########################
119+
wait_for_log_entry() {
120+
local -r entry="${1:-missing entry}"
121+
local -r log_file="${2:-missing log file}"
122+
local -r retries="${3:-12}"
123+
local -r interval_time="${4:-5}"
124+
local attempt=0
125+
126+
check_log_file_for_entry() {
127+
if ! grep -qE "$entry" "$log_file"; then
128+
debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})"
129+
return 1
130+
fi
131+
}
132+
debug "Checking that ${log_file} log file contains entry \"${entry}\""
133+
if retry_while check_log_file_for_entry "$retries" "$interval_time"; then
134+
debug "Found entry \"${entry}\" in ${log_file}"
135+
true
136+
else
137+
error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries"
138+
debug_execute cat "$log_file"
139+
return 1
140+
fi
141+
}

0 commit comments

Comments
 (0)