Skip to content

Commit 9c8ef1b

Browse files
committed
Parameterize docker build with cardano-node-version & add it to tags.
1 parent 1c7f23c commit 9c8ef1b

2 files changed

Lines changed: 33 additions & 5 deletions

File tree

.github/workflows/package.yaml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
os: [ ubuntu-20.04 ]
5454
target: [ ogmios, cardano-node-ogmios ]
5555
network: [ "mainnet", "testnet", "vasil-dev" ]
56+
cardano_node_version: [ "1.35.2" ]
5657

5758
runs-on: ${{ matrix.os }}
5859
steps:
@@ -114,19 +115,43 @@ jobs:
114115
cache-to: type=inline
115116

116117
- name: 🏷️ Build and push (default tag)
117-
if: ${{ github.event_name == 'push' && matrix.network == 'mainnet' && startsWith(github.ref, 'refs/tags') }}
118+
if: ${{ github.event_name == 'push' && matrix.network == 'mainnet' && startsWith(github.ref, 'refs/tags') && matrix.target == 'cardano-node-ogmios' }}
118119
uses: docker/build-push-action@v2
119120
with:
120121
build-args: NETWORK=${{ matrix.network }}
121122
context: .
122123
push: true
123-
tags: ${{ steps.base-variables.outputs.image }}:${{ steps.tag-variables.outputs.tag }}
124+
tags: ${{ steps.base-variables.outputs.image }}:${{ steps.tag-variables.outputs.tag }}_${{ matrix.cardano_node_version }}
125+
target: ${{ matrix.target }}
126+
cache-from: type=registry,ref=${{ steps.base-variables.outputs.image }}:latest
127+
cache-to: type=inline
128+
129+
- name: 🏷️ Build and push (default tag)
130+
if: ${{ github.event_name == 'push' && matrix.network == 'mainnet' && startsWith(github.ref, 'refs/tags') && matrix.target == 'ogmios' }}
131+
uses: docker/build-push-action@v2
132+
with:
133+
build-args: NETWORK=${{ matrix.network }}, CARDANO_NODE_VERSION=${{ matrix.cardano_node_version }}
134+
context: .
135+
push: true
136+
tags: ${{ steps.base-variables.outputs.image }}:${{ steps.tag-variables.outputs.tag }}_${{ matrix.cardano_node_version }}
124137
target: ${{ matrix.target }}
125138
cache-from: type=registry,ref=${{ steps.base-variables.outputs.image }}:latest
126139
cache-to: type=inline
127140

128141
- name: 🏷️ Build and push (network tags)
129-
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
142+
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && matrix.target == 'cardano-node-ogmios' }}
143+
uses: docker/build-push-action@v2
144+
with:
145+
build-args: NETWORK=${{ matrix.network }}, CARDANO_NODE_VERSION=${{ matrix.cardano_node_version }}
146+
context: .
147+
push: true
148+
tags: ${{ steps.base-variables.outputs.image }}:${{ steps.tag-variables.outputs.tag }}_${{ matrix.cardano_node_version }}-${{ matrix.network }}
149+
target: ${{ matrix.target }}
150+
cache-from: type=registry,ref=${{ steps.base-variables.outputs.image }}:latest-${{ matrix.network }}
151+
cache-to: type=inline
152+
153+
- name: 🏷️ Build and push (network tags)
154+
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && matrix.target == 'ogmios' }}
130155
uses: docker/build-push-action@v2
131156
with:
132157
build-args: NETWORK=${{ matrix.network }}

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# ------------------------------- SETUP ------------------------------------- #
77
# #
88

9+
ARG CARDANO_NODE_VERSION=1.35.2
10+
911
FROM nixos/nix:2.3.11 as build
1012

1113
ARG CARDANO_CONFIG_REV=08e6c0572d5d48049fab521995b29607e0a91a9e
@@ -14,7 +16,7 @@ RUN echo "substituters = https://cache.nixos.org https://hydra.iohk.io" >> /etc/
1416
echo "trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" >> /etc/nix/nix.conf
1517

1618
WORKDIR /app
17-
RUN nix-shell -p git --command "git clone --depth 1 https://github.com/input-output-hk/cardano-configurations.git"
19+
RUN nix-shell -p git --command "git clone https://github.com/input-output-hk/cardano-configurations.git"
1820

1921
WORKDIR /app/ogmios
2022
RUN nix-env -iA cachix -f https://cachix.org/api/v1/install && cachix use cardano-ogmios
@@ -51,7 +53,8 @@ ENTRYPOINT ["/bin/ogmios"]
5153
# --------------------- RUN (cardano-node & ogmios) -------------------------- #
5254
# #
5355

54-
FROM inputoutput/cardano-node:1.35.2 as cardano-node-ogmios
56+
ARG CARDANO_NODE_VERSION=1.35.2
57+
FROM inputoutput/cardano-node:${CARDANO_NODE_VERSION} as cardano-node-ogmios
5558

5659
ARG NETWORK=mainnet
5760
ENV TINI_VERSION v0.19.0

0 commit comments

Comments
 (0)