Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: publish docker image only to public registry #829

Merged
merged 6 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 9 additions & 9 deletions .maintain/build-image.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Up @@ -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
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading