Skip to content

Commit beb8413

Browse files
authored
Ralphex image fixes (#22)
* fix: use GNU sed for Linux + add AI agent best practices to AGENTS.md * fix: use heredoc for multi-line commit message (YAML syntax) * fix: use multiple git -m flags instead of heredoc for YAML compatibility * feat: add RALPHEX_TAG ARG for version pinning * feat: simplify ralphex versioning to match Bun/Hugo pattern * feat: pin ralphex to v0.9.0, simplify workflow to match Bun/Hugo * fix: include ralphex version in image tag for build-ralphex-fe workflow * feat: install ralphex from releases (not base image), pin to v0.9.0
1 parent 6e97e4f commit beb8413

3 files changed

Lines changed: 32 additions & 24 deletions

File tree

‎.github/workflows/build-ralphex-fe.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ jobs:
103103
cache-to: type=gha,mode=max
104104

105105
- name: Verify image
106+
env:
107+
TAGS: ${{ steps.tags.outputs.tags }}
106108
run: |
107-
TAGS="${{ steps.tags.outputs.tags }}"
108109
FIRST_TAG=$(echo "$TAGS" | cut -d',' -f1)
109110
110111
echo "Verifying multiplatform image: $FIRST_TAG"

‎.github/workflows/update-and-build-ralphex-fe.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
versions_updated: ${{ steps.update.outputs.updated }}
3838
bun_version: ${{ steps.update.outputs.bun_version }}
3939
hugo_version: ${{ steps.update.outputs.hugo_version }}
40+
ralphex_version: ${{ steps.update.outputs.ralphex_version }}
4041

4142
steps:
4243
- name: Checkout repository
@@ -80,6 +81,7 @@ jobs:
8081
echo "Updated versions in Dockerfile:"
8182
grep '^ARG BUN_VERSION=' "${{ env.DOCKERFILE_PATH }}"
8283
grep '^ARG HUGO_VERSION=' "${{ env.DOCKERFILE_PATH }}"
84+
grep '^ARG RALPHEX_VERSION=' "${{ env.DOCKERFILE_PATH }}"
8385
8486
# Check if anything changed
8587
if git diff --quiet "${{ env.DOCKERFILE_PATH }}"; then
@@ -148,9 +150,7 @@ jobs:
148150
run: |
149151
BUN_VERSION=$(grep '^ARG BUN_VERSION=' "${{ env.DOCKERFILE_PATH }}" | cut -d'=' -f2)
150152
HUGO_VERSION=$(grep '^ARG HUGO_VERSION=' "${{ env.DOCKERFILE_PATH }}" | cut -d'=' -f2)
151-
152-
# Ralphex version comes from the update job output
153-
RALPHEX_VERSION="${{ needs.update-dockerfile.outputs.ralphex_version }}"
153+
RALPHEX_VERSION=$(grep '^ARG RALPHEX_VERSION=' "${{ env.DOCKERFILE_PATH }}" | cut -d'=' -f2)
154154
155155
echo "bun=$BUN_VERSION" >> $GITHUB_OUTPUT
156156
echo "hugo=$HUGO_VERSION" >> $GITHUB_OUTPUT

‎ralphex-fe/Dockerfile‎

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,48 @@
11
ARG BUN_VERSION=1.3.8
2-
ARG HUGO_VERSION=0.155.2
3-
ARG RALPHEX_VERSION=v0.9.0
42

5-
# ralphex base image - pinned version like Bun and Hugo
6-
FROM ghcr.io/umputun/ralphex:${RALPHEX_VERSION}
3+
FROM oven/bun:${BUN_VERSION}-alpine
74

8-
ARG BUN_VERSION
9-
ARG HUGO_VERSION
5+
ARG HUGO_VERSION=0.155.2
6+
ARG RALPHEX_VERSION=0.9.0
107

118
# Platform architecture (automatically set by Docker based on build platform)
129
ARG TARGETARCH
1310

1411
# Install dependencies:
15-
# - bash: Required by Bun install script (uses bash -s)
1612
# - ca-certificates: Required for HTTPS connections
17-
# - curl: Required by Bun install script
1813
# - gcompat: glibc compatibility layer required for Hugo Extended binary (Alpine uses musl)
1914
# - go: Required for Hugo Modules to download and manage dependencies (e.g., PaperMod theme)
20-
# - unzip: Required by Bun install script on Linux
21-
# - wget: Required to download Hugo Extended binary
22-
RUN apk add --no-cache bash ca-certificates curl gcompat go unzip wget
23-
24-
# Install Bun using official install script
25-
# BUN_INSTALL sets the installation directory
26-
ENV BUN_INSTALL=/usr/local/bun
27-
ENV PATH="$BUN_INSTALL/bin:$PATH"
15+
# - wget: Required to download Hugo and Ralphex binaries
16+
RUN apk add --no-cache ca-certificates gcompat go wget
2817

29-
RUN curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}" && \
30-
bun --version
18+
# Install Ralphex by downloading pre-built binary with checksum verification
19+
RUN set -eux; \
20+
wget -O ralphex.tar.gz "https://github.com/umputun/ralphex/releases/download/v${RALPHEX_VERSION}/ralphex_${RALPHEX_VERSION}_linux_${TARGETARCH}.tar.gz"; \
21+
wget -O ralphex_checksums.txt "https://github.com/umputun/ralphex/releases/download/v${RALPHEX_VERSION}/ralphex_${RALPHEX_VERSION}_checksums.txt"; \
22+
EXPECTED_CHECKSUM=$(grep "ralphex_${RALPHEX_VERSION}_linux_${TARGETARCH}.tar.gz" ralphex_checksums.txt | cut -d' ' -f1); \
23+
if [ -z "$EXPECTED_CHECKSUM" ]; then \
24+
echo "Error: Could not find checksum for ralphex_${RALPHEX_VERSION}_linux_${TARGETARCH}.tar.gz"; \
25+
exit 1; \
26+
fi; \
27+
ACTUAL_CHECKSUM=$(sha256sum ralphex.tar.gz | cut -d' ' -f1); \
28+
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then \
29+
echo "Checksum verification failed for Ralphex!"; \
30+
echo "Expected: $EXPECTED_CHECKSUM"; \
31+
echo "Actual: $ACTUAL_CHECKSUM"; \
32+
exit 1; \
33+
fi; \
34+
echo "Ralphex checksum verified: $ACTUAL_CHECKSUM"; \
35+
tar -xzf ralphex.tar.gz -C /usr/local/bin/ ralphex; \
36+
rm ralphex.tar.gz ralphex_checksums.txt; \
37+
ralphex --version
3138

3239
# Install Hugo Extended by downloading pre-built binary with checksum verification
3340
RUN set -eux; \
3441
wget -O hugo.tar.gz "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.tar.gz"; \
3542
wget -O hugo_checksums.txt "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_checksums.txt"; \
3643
EXPECTED_CHECKSUM=$(grep "hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.tar.gz" hugo_checksums.txt | cut -d' ' -f1); \
3744
if [ -z "$EXPECTED_CHECKSUM" ]; then \
38-
echo "Error: Could not find checksum for hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.tar.gz in checksums file"; \
45+
echo "Error: Could not find checksum for hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.tar.gz"; \
3946
exit 1; \
4047
fi; \
4148
ACTUAL_CHECKSUM=$(sha256sum hugo.tar.gz | cut -d' ' -f1); \
@@ -52,7 +59,7 @@ RUN set -eux; \
5259

5360
# OCI labels for container metadata and GitHub Package integration
5461
LABEL org.opencontainers.image.source="https://github.com/gatezh/devcontainer-images"
55-
LABEL org.opencontainers.image.description="Ralphex-fe: Frontend development image with Bun and Hugo Extended - multiplatform image for modern development"
62+
LABEL org.opencontainers.image.description="Ralphex-fe: Frontend development image with Bun, Hugo Extended, and Ralphex"
5663
LABEL org.opencontainers.image.licenses="MIT"
5764
LABEL org.opencontainers.image.title="ralphex-fe"
5865
LABEL org.opencontainers.image.url="https://github.com/gatezh/devcontainer-images"

0 commit comments

Comments
 (0)