diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..e22a20218c65142d808b05ae75b9cd293ee14a49 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,47 @@ +stages: + - build + +.g1_data: + before_script: + # can be called with `sqd download-genesis` + # download output from py-g1-migrator CI run by Duniter + # genesis.json is only used for export block + - wget https://git.duniter.org/nodes/rust/duniter-v2s/-/jobs/$JOB/artifacts/download -O artifacts.zip + - unzip -j artifacts.zip -d input + - rm artifacts.zip + + # download gdev.json + # for the moment, use previous version commited to duniter-squid since Duniter artifacts expired + # when new artifacts are generated and set to never expire, will use it instead + - wget "https://git.duniter.org/nodes/duniter-squid/-/raw/add-certifications-date/assets/gdev.json?ref_type=heads" -O ./input/gdev.json + +.build: + stage: build + image: docker:latest + tags: + - docker + services: + - docker:dind + rules: + - if: $CI_COMMIT_TAG + script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + - docker build --pull -t "$CI_REGISTRY_IMAGE/$GROUP:$CI_COMMIT_TAG" -f $DOCKERFILE . + - docker push "$CI_REGISTRY_IMAGE/$GROUP:$CI_COMMIT_TAG" + - docker tag "$CI_REGISTRY_IMAGE/$GROUP:$CI_COMMIT_TAG" "$CI_REGISTRY_IMAGE/$GROUP:latest" + - docker push "$CI_REGISTRY_IMAGE/$GROUP:latest" + +build:squid: + extends: + - .g1_data + - .build + variables: + JOB: 131675 # id from duniter-v2s' create_g1_data job + DOCKERFILE: Dockerfile + GROUP: squid + +build:hasura: + extends: .build + variables: + DOCKERFILE: Dockerfile.Hasura + GROUP: hasura diff --git a/README.md b/README.md index 82a3bab7cc71323b59930a921043875b2e157c85..de993021449e8f2c66c1817a0a2cacc534897446 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,6 @@ From the root of the repository, run following command: ./scripts/download_genesis.sh # Build containers -./scripts/build-docker-image-squid.sh -./scripts/build-docker-image-hasura.sh +docker build -f Dockerfile +docker build -f Dockerfile.Hasura ``` diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index d51210258b6877381c7a27dbb2cd19afe1d1d180..f16e47acbda22d85c69fd40e6cf8c36a8509ee01 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -17,7 +17,7 @@ services: - "${DB_DEV_PORT}:5432" # command: ["postgres", "-c", "log_statement=all"] hasura-squid: - image: h30x/duniter-squid-hasura:latest + image: registry.duniter.org/nodes/duniter-squid/hasura:latest depends_on: db: condition: service_healthy @@ -40,4 +40,4 @@ services: - ./config.yaml:/config.yaml volumes: - pg-dev: \ No newline at end of file + pg-dev: diff --git a/docker-compose.yml b/docker-compose.yml index db7a0a11ea00c818f95f6c87c81739858431a325..20d796c64705a27587639e9e3c73d7de172d035a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: # squid processor eating date from duniter archive (RPC_ENDPOINT) and putting them in db processor: - image: h30x/duniter-squid:latest + image: registry.duniter.org/nodes/duniter-squid/squid:latest depends_on: db: condition: service_healthy @@ -35,7 +35,7 @@ services: POSTGRES_PASSWORD: ${DB_PASSWORD} # hasura eating in db and giving graphql hasura-squid: - image: h30x/duniter-squid-hasura:latest + image: registry.duniter.org/nodes/duniter-squid/hasura:latest depends_on: processor: condition: service_healthy diff --git a/scripts/build-docker-image-hasura.sh b/scripts/build-docker-image-hasura.sh deleted file mode 100755 index fd1932a7c529cfc269fcf995a8992021c904cf40..0000000000000000000000000000000000000000 --- a/scripts/build-docker-image-hasura.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -e - -# Get the version number from package.json -version_tag=$(grep -oP '"version": "\K[^"]+' package.json) - -latest_tag="latest" - -docker buildx build -f Dockerfile.Hasura -t duniter-squid-hasura . - -# Tag specific version -docker image tag duniter-squid-hasura:latest h30x/duniter-squid-hasura:$version_tag -docker image push h30x/duniter-squid-hasura:$version_tag - -# Tag "latest" -docker image tag duniter-squid-hasura:latest h30x/duniter-squid-hasura:$latest_tag -docker image push h30x/duniter-squid-hasura:$latest_tag diff --git a/scripts/build-docker-image-squid.sh b/scripts/build-docker-image-squid.sh deleted file mode 100755 index 2047458ca9e4eb3ce71bfb7296a3499f37122b6a..0000000000000000000000000000000000000000 --- a/scripts/build-docker-image-squid.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -e - -# Get the version number from package.json -version_tag=$(grep -oP '"version": "\K[^"]+' package.json) - -latest_tag="latest" - -docker buildx build -f Dockerfile -t duniter-squid . - -# Tag specific version -docker image tag duniter-squid:latest h30x/duniter-squid:$version_tag -docker image push h30x/duniter-squid:$version_tag - -# Tag "latest" -docker image tag duniter-squid:latest h30x/duniter-squid:$latest_tag -docker image push h30x/duniter-squid:$latest_tag diff --git a/scripts/download_genesis.sh b/scripts/download_genesis.sh index 1c6d06a5ea4b0a6556f008774c99a229322aa056..4cd5145c23f6db256b8e90e91657504a6a2262df 100755 --- a/scripts/download_genesis.sh +++ b/scripts/download_genesis.sh @@ -5,11 +5,11 @@ JOB=131675 # id of the create_g1_data job # download output from py-g1-migrator CI run by Duniter # genesis.json is only used for export block -curl https://git.duniter.org/nodes/rust/duniter-v2s/-/jobs/$JOB/artifacts/download > artifacts.zip +wget https://git.duniter.org/nodes/rust/duniter-v2s/-/jobs/$JOB/artifacts/download -O artifacts.zip unzip -j artifacts.zip -d input rm artifacts.zip # download gdev.json # for the moment, use previous version commited to duniter-squid since Duniter artifacts expired # when new artifacts are generated and set to never expire, will use it instead -curl "https://git.duniter.org/nodes/duniter-squid/-/raw/add-certifications-date/assets/gdev.json?ref_type=heads" -o ./input/gdev.json +wget "https://git.duniter.org/nodes/duniter-squid/-/raw/add-certifications-date/assets/gdev.json?ref_type=heads" -O ./input/gdev.json