Skip to content

Commit bb932e2

Browse files
author
Samuel Dare
committed
chore: add metadatahash, build images only on publish tags
1 parent bc15020 commit bb932e2

File tree

4 files changed

+30
-32
lines changed

4 files changed

+30
-32
lines changed

.github/workflows/docker.yml

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,42 @@
11
name: Publish Docker Image
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
tags:
8-
- '*'
9-
pull_request:
10-
branches:
11-
- main
12-
workflow_dispatch:
4+
release:
5+
types: [published]
136

147
permissions:
15-
contents: read
16-
packages: write
17-
actions: read
18-
security-events: write
8+
contents: read
9+
packages: write
10+
actions: read
11+
security-events: write
1912

2013
jobs:
2114
publish:
2215
runs-on: SubtensorCI
23-
16+
2417
steps:
2518
- name: Checkout code
2619
uses: actions/checkout@v4
27-
20+
2821
- name: Set up QEMU
2922
uses: docker/setup-qemu-action@v2
30-
23+
3124
- name: Set up Docker Buildx
3225
uses: docker/setup-buildx-action@v2
33-
26+
3427
- name: Login to GHCR
3528
uses: docker/login-action@v2
3629
with:
3730
registry: ghcr.io
3831
username: ${{ github.actor }}
3932
password: ${{ secrets.GITHUB_TOKEN }}
40-
33+
4134
- name: Extract metadata (tags, labels) for Docker
4235
id: meta
4336
uses: docker/metadata-action@v4
4437
with:
4538
images: ghcr.io/${{ github.repository }}
46-
39+
4740
- name: Build and push Docker image
4841
uses: docker/build-push-action@v4
4942
with:
@@ -52,4 +45,4 @@ jobs:
5245
tags: |
5346
${{ steps.meta.outputs.tags }}
5447
ghcr.io/${{ github.repository }}:latest
55-
labels: ${{ steps.meta.outputs.labels }}
48+
labels: ${{ steps.meta.outputs.labels }}

Cargo.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,12 @@ codegen-units = 1
167167

168168
[features]
169169
default = []
170-
try-runtime = ["node-subtensor/try-runtime", "node-subtensor-runtime/try-runtime"]
171-
runtime-benchmarks = ["node-subtensor/runtime-benchmarks", "node-subtensor-runtime/runtime-benchmarks"]
170+
try-runtime = [
171+
"node-subtensor/try-runtime",
172+
"node-subtensor-runtime/try-runtime",
173+
]
174+
runtime-benchmarks = [
175+
"node-subtensor/runtime-benchmarks",
176+
"node-subtensor-runtime/runtime-benchmarks",
177+
]
178+
metadata-hash = ["node-subtensor-runtime/metadata-hash"]

Dockerfile

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG BASE_IMAGE=ubuntu:20.04
22

3-
FROM $BASE_IMAGE as builder
3+
FROM $BASE_IMAGE AS builder
44
SHELL ["/bin/bash", "-c"]
55

66
# Set noninteractive mode for apt-get
@@ -10,29 +10,25 @@ LABEL ai.opentensor.image.authors="[email protected]" \
1010
ai.opentensor.image.vendor="Opentensor Foundation" \
1111
ai.opentensor.image.title="opentensor/subtensor" \
1212
ai.opentensor.image.description="Opentensor Subtensor Blockchain" \
13-
ai.opentensor.image.revision="${VCS_REF}" \
14-
ai.opentensor.image.created="${BUILD_DATE}" \
1513
ai.opentensor.image.documentation="https://docs.bittensor.com"
1614

1715
# Set up Rust environment
18-
ENV RUST_BACKTRACE 1
16+
ENV RUST_BACKTRACE=1
1917
RUN apt-get update && \
2018
apt-get install -y curl build-essential protobuf-compiler clang git && \
2119
rm -rf /var/lib/apt/lists/*
2220

2321
RUN set -o pipefail && curl https://sh.rustup.rs -sSf | sh -s -- -y
2422
ENV PATH="/root/.cargo/bin:${PATH}"
25-
26-
RUN rustup update nightly
2723
RUN rustup update stable
28-
RUN rustup target add wasm32-unknown-unknown --toolchain nightly
24+
RUN rustup target add wasm32-unknown-unknown --toolchain stable
2925

3026
# Copy entire repository
3127
COPY . /build
3228
WORKDIR /build
3329

3430
# Build the project
35-
RUN cargo build -p node-subtensor --profile production --features runtime-benchmarks --locked
31+
RUN cargo build -p node-subtensor --profile production --features="runtime-benchmarks metadata-hash" --locked
3632

3733
# Verify the binary was produced
3834
RUN test -e /build/target/production/node-subtensor

node/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ runtime-benchmarks = [
9292
"frame-system/runtime-benchmarks",
9393
"sc-service/runtime-benchmarks",
9494
"sp-runtime/runtime-benchmarks",
95-
"pallet-commitments/runtime-benchmarks"
95+
"pallet-commitments/runtime-benchmarks",
9696
]
9797
pow-faucet = []
9898

@@ -103,5 +103,7 @@ try-runtime = [
103103
"frame-system/try-runtime",
104104
"pallet-transaction-payment/try-runtime",
105105
"sp-runtime/try-runtime",
106-
"pallet-commitments/try-runtime"
106+
"pallet-commitments/try-runtime",
107107
]
108+
109+
metadata-hash = ["node-subtensor-runtime/metadata-hash"]

0 commit comments

Comments
 (0)