Skip to content

Commit

Permalink
Merge pull request #27 from blockjoy/bug/fix-image-versioning
Browse files Browse the repository at this point in the history
Improved image versioning for Renovate
  • Loading branch information
mateipopa authored Dec 24, 2024
2 parents fe4a0a1 + 601f543 commit d8dfd7a
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 16 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ jobs:
id: version
run: |
SHA=$(git rev-parse --short HEAD)
VERSION=$(git rev-list --count HEAD)
echo "image_name=node-base" >> $GITHUB_OUTPUT
echo "image_tag=${SHA}" >> $GITHUB_OUTPUT
echo "version_tag=v${VERSION}" >> $GITHUB_OUTPUT
echo "sha=${SHA}" >> $GITHUB_OUTPUT
- name: Generate build contexts
id: build-contexts
Expand Down Expand Up @@ -174,7 +176,9 @@ jobs:
build-contexts: ${{ steps.build-contexts.outputs.contexts }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ghcr.io/blockjoy/${{ steps.version.outputs.image_name }}:${{ steps.version.outputs.image_tag }}
tags: |
ghcr.io/blockjoy/${{ steps.version.outputs.image_name }}:${{ steps.version.outputs.image_tag }}
ghcr.io/blockjoy/${{ steps.version.outputs.image_name }}:${{ steps.version.outputs.version_tag }}
build-clients:
needs: [detect-changes, build-base]
Expand All @@ -196,6 +200,7 @@ jobs:
id: version
run: |
SHA=$(git rev-parse --short HEAD)
VERSION=$(git rev-list --count HEAD)
CLIENT_NAME=$(basename ${{ matrix.image_path }})
IMAGE_NAME="${CLIENT_NAME}"
Expand All @@ -216,6 +221,7 @@ jobs:
fi
echo "image_name=${IMAGE_NAME}" >> $GITHUB_OUTPUT
echo "image_tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT
echo "version_tag=v${VERSION}" >> $GITHUB_OUTPUT
echo "sha=${SHA}" >> $GITHUB_OUTPUT
- name: Generate build contexts
id: build-contexts
Expand Down Expand Up @@ -261,7 +267,9 @@ jobs:
build-contexts: ${{ steps.build-contexts.outputs.contexts }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ghcr.io/blockjoy/${{ steps.version.outputs.image_name }}:${{ steps.version.outputs.image_tag }}
tags: |
ghcr.io/blockjoy/${{ steps.version.outputs.image_name }}:${{ steps.version.outputs.image_tag }}
ghcr.io/blockjoy/${{ steps.version.outputs.image_name }}:${{ steps.version.outputs.version_tag }}
build-protocols:
needs: [detect-changes]
Expand All @@ -281,6 +289,7 @@ jobs:
id: version
run: |
SHA=$(git rev-parse --short HEAD)
VERSION=$(git rev-list --count HEAD)
if [[ -n "${{ matrix.image_path }}" ]]; then
# Only try to generate image name if matrix path is not empty
IMAGE_NAME=$(basename $(dirname "${{ matrix.image_path }}"))"-"$(basename "${{ matrix.image_path }}")
Expand All @@ -290,6 +299,7 @@ jobs:
exit 1
fi
echo "image_tag=${SHA}" >> $GITHUB_OUTPUT
echo "version_tag=v${VERSION}" >> $GITHUB_OUTPUT
echo "sha=${SHA}" >> $GITHUB_OUTPUT
- name: Generate build contexts
id: build-contexts
Expand Down Expand Up @@ -348,4 +358,6 @@ jobs:
build-contexts: ${{ steps.build-contexts.outputs.contexts }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ghcr.io/blockjoy/${{ steps.version.outputs.image_name }}:${{ steps.version.outputs.image_tag }}
tags: |
ghcr.io/blockjoy/${{ steps.version.outputs.image_name }}:${{ steps.version.outputs.image_tag }}
ghcr.io/blockjoy/${{ steps.version.outputs.image_name }}:${{ steps.version.outputs.version_tag }}
4 changes: 2 additions & 2 deletions clients/consensus/lighthouse/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_IMAGE=node-base:latest
FROM ghcr.io/blockjoy/${BASE_IMAGE}
ARG BASE_IMAGE=ghcr.io/blockjoy/node-base:v1
FROM ${BASE_IMAGE}

ENV DEBIAN_FRONTEND=noninteractive

Expand Down
2 changes: 1 addition & 1 deletion clients/exec/erigon/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BASE_IMAGE=node-base:latest
ARG BASE_IMAGE=ghcr.io/blockjoy/node-base:v1
FROM ghcr.io/blockjoy/${BASE_IMAGE} as builder

ENV DEBIAN_FRONTEND=noninteractive
Expand Down
6 changes: 3 additions & 3 deletions clients/exec/reth/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_IMAGE=node-base:latest
FROM ghcr.io/blockjoy/${BASE_IMAGE} as builder
ARG BASE_IMAGE=ghcr.io/blockjoy/node-base:v1
FROM ${BASE_IMAGE} as builder

ENV DEBIAN_FRONTEND=noninteractive
ENV RETH_VERSION=v1.1.4
Expand Down Expand Up @@ -35,5 +35,5 @@ RUN --mount=type=cache,target=/root/.cargo/git \
cp target/maxperf/reth /root/bin/

# Create minimal final image
FROM ghcr.io/blockjoy/${BASE_IMAGE}
FROM ${BASE_IMAGE}
COPY --from=builder /root/bin/reth /root/bin/reth
6 changes: 3 additions & 3 deletions ethereum/ethereum-erigon/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG ERIGON_IMAGE=ghcr.io/blockjoy/erigon:latest
ARG LIGHTHOUSE_IMAGE=ghcr.io/blockjoy/lighthouse:latest
ARG BASE_IMAGE=ghcr.io/blockjoy/node-base:latest
ARG ERIGON_IMAGE=ghcr.io/blockjoy/erigon:v1
ARG LIGHTHOUSE_IMAGE=ghcr.io/blockjoy/lighthouse:v1
ARG BASE_IMAGE=ghcr.io/blockjoy/node-base:v1

FROM ${ERIGON_IMAGE} as erigon-build

Expand Down
6 changes: 3 additions & 3 deletions ethereum/ethereum-reth/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG RETH_IMAGE=ghcr.io/blockjoy/reth:latest
ARG LIGHTHOUSE_IMAGE=ghcr.io/blockjoy/lighthouse:latest
ARG BASE_IMAGE=ghcr.io/blockjoy/node-base:latest
ARG RETH_IMAGE=ghcr.io/blockjoy/reth:v1
ARG LIGHTHOUSE_IMAGE=ghcr.io/blockjoy/lighthouse:v1
ARG BASE_IMAGE=ghcr.io/blockjoy/node-base:v1

FROM ${RETH_IMAGE} AS reth-build

Expand Down
3 changes: 2 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"dependencyDashboard": true,
"dependencyDashboardTitle": "Dependencies Dashboard",
"docker": {
"enabled": true
"enabled": true,
"versioning": "regex:^v(?<major>\\d+)$"
},
"hostRules": [
{
Expand Down

0 comments on commit d8dfd7a

Please sign in to comment.