Skip to content

Commit

Permalink
ci: publish docker image only to public registry (#829)
Browse files Browse the repository at this point in the history
## fixes KILTprotocol/ticket#3600
Maintain only two versions of docker images on the public registry.
`kiltprotocol/kilt-node`
`kiltprotocol/standalone-node`
## Metadata Diff to Develop Branch

<details>
<summary>Peregrine Diff</summary>

```
```

</details>

<details>
<summary>Spiritnet Diff</summary>

```
```

</details>

## Checklist:

- [ ] I have verified that the code works
- [ ] No panics! (checked arithmetic ops, no indexing `array[3]` use
`get(3)`, ...)
- [ ] I have verified that the code is easy to understand
  - [ ] If not, I have left a well-balanced amount of inline comments
- [ ] I have [left the code in a better
state](https://deviq.com/principles/boy-scout-rule)
- [ ] I have documented the changes (where applicable)
* Either PR or Ticket to update [the
Docs](https://github.com/KILTprotocol/docs)
    * Link the PR/Ticket here
ggera authored Dec 10, 2024
1 parent f6a0908 commit b7ae8d5
Showing 6 changed files with 11 additions and 26 deletions.
3 changes: 0 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -78,12 +78,9 @@ build-docker-images:
DOCKER_HUB_DIP_PROVIDER_TEMPLATE: "kiltprotocol/dip-provider-node-template"
DOCKER_HUB_DIP_CONSUMER_TEMPLATE: "kiltprotocol/dip-consumer-node-template"
before_script:
- aws --version
- docker --version
script:
- echo -n $CI_REGISTRY_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
- aws ecr get-login-password | docker login --username AWS --password-stdin $AWS_REGISTRY
- ./.maintain/docker-auth-config.sh

- ./.maintain/build-image.sh build
- "if [[ ! -z ${CI_COMMIT_BRANCH} ]]; then ./.maintain/push-image.sh build ${CI_COMMIT_SHORT_SHA}; fi"
18 changes: 9 additions & 9 deletions .maintain/build-image.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -7,10 +7,10 @@ target_tag=$1
# Build the builder image and push it in the background
docker build \
--target builder \
--cache-from $AWS_REGISTRY/kilt-parachain/collator:builder \
-t $AWS_REGISTRY/kilt-parachain/collator:builder \
--cache-from $CI_REGISTRY/kilt-node:builder \
-t $CI_REGISTRY/kilt-node:builder \
. &
docker push $AWS_REGISTRY/kilt-parachain/collator:builder &
docker push $CI_REGISTRY/kilt-node:builder &

wait

@@ -21,19 +21,19 @@ build_and_tag() {
local cache_image=$3

docker build \
--cache-from $AWS_REGISTRY/kilt-parachain/collator:builder \
--cache-from $AWS_REGISTRY/$cache_image:$target_tag \
--cache-from $CI_REGISTRY/kilt-node:builder \
--cache-from $CI_REGISTRY/$cache_image:$target_tag \
--build-arg NODE_TYPE=$node_type \
-t local/$image_name:$target_tag \
.
}

build_and_tag "kilt-parachain" "kilt-node" "kilt-parachain/collator" &
build_and_tag "kilt-parachain" "kilt-node" "kilt-node" &

build_and_tag "standalone-node" "standalone-node" "kilt/prototype-chain" &
build_and_tag "standalone-node" "standalone-node" "standalone-node" &

build_and_tag "dip-provider-node-template" "dip-provider-node-template" "kilt-parachain/collator" &
build_and_tag "dip-provider-node-template" "dip-provider-node-template" "kilt-node" &

build_and_tag "dip-consumer-node-template" "dip-consumer-node-template" "kilt-parachain/collator" &
build_and_tag "dip-consumer-node-template" "dip-consumer-node-template" "kilt-node" &

wait
6 changes: 0 additions & 6 deletions .maintain/docker-auth-config.sh

This file was deleted.

6 changes: 0 additions & 6 deletions .maintain/push-image.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -21,10 +21,4 @@ tag_and_push local/kilt-node:$source_tag ${DOCKER_HUB_PARACHAIN}:$target_tag
tag_and_push local/$PROVIDER_BIN_NAME:$source_tag ${DOCKER_HUB_DIP_PROVIDER_TEMPLATE}:$target_tag
tag_and_push local/$CONSUMER_BIN_NAME:$source_tag ${DOCKER_HUB_DIP_CONSUMER_TEMPLATE}:$target_tag

# Tag and push to AWS
tag_and_push local/standalone-node:$source_tag $AWS_REGISTRY/standalone-node:$target_tag
tag_and_push local/kilt-node:$source_tag $AWS_REGISTRY/kilt-node:$target_tag
tag_and_push local/$PROVIDER_BIN_NAME:$source_tag $AWS_REGISTRY/$PROVIDER_BIN_NAME:$target_tag
tag_and_push local/$CONSUMER_BIN_NAME:$source_tag $AWS_REGISTRY/$CONSUMER_BIN_NAME:$target_tag

wait
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ RUN cargo build --locked --release --features $FEATURES

# ===== SECOND STAGE ======

FROM docker.io/library/ubuntu:20.04
FROM docker.io/library/ubuntu:22.04
LABEL description="This is the 2nd stage: a very small image where we copy the kilt-parachain binary."

ARG NODE_TYPE=kilt-parachain
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ services:
dev-node:
build: .
image: local/standalone-node
command: ./target/release/standalone-node --dev --ws-port 9944 --ws-external
command: ./target/release/standalone-node --dev --rpc-port 9944 --rpc-external
ports:
- 9944:9944
sdk:

0 comments on commit b7ae8d5

Please sign in to comment.