Skip to content

Commit

Permalink
Docs: adds readme for dockerhub
Browse files Browse the repository at this point in the history
  • Loading branch information
pustovitDmytro committed Mar 10, 2023
1 parent ebd68e6 commit c30c28d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ jobs:
version: 20.10.14
- restore_cache:
<<: *cache-defaults
- run:
name: Install jq
command: sudo apt-get install jq -y
- run:
name: Create Release
command: if [ -z ${CIRCLE_SKIP_DEPLOY+x} ]; then npm run semantic-release;else echo 'job skipped';fi
Expand Down Expand Up @@ -205,7 +208,9 @@ workflows:
requires:
- install
- deploy:
context: npm-packages
context:
- npm-packages
- docker
requires:
- test-coverage
- test-package
Expand Down
7 changes: 7 additions & 0 deletions bin/release/prepare.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
#!/bin/bash

set -e

VERSION=$1

docker build -t pustovitdmytro/ianus-base:$VERSION -f docker/Base.dockerfile .
docker build -t pustovitdmytro/ianus-worker:$VERSION -f docker/Worker.dockerfile .
docker build -t pustovitdmytro/ianus-admin:$VERSION -f docker/Admin.dockerfile .

repo_url=$(cat package.json | jq -r .repository.url)
readme=$(jq tostring --raw-input --slurp README.md)

echo '{"full_description":'$readme',"description":"'"$repo_url"'"}' > .dockerhub.readme
6 changes: 6 additions & 0 deletions bin/release/publish.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#!/bin/bash

set -e

VERSION=$1
MINOR=${VERSION%.*}
MAJOR=${MINOR%.*}

jwt=$(cat .dockerhub.jwt)
readme=$(cat .dockerhub.readme)

for image in "pustovitdmytro/ianus-base" "pustovitdmytro/ianus-admin" "pustovitdmytro/ianus-worker"; do
for tag in $VERSION $MINOR $MAJOR "latest"; do
docker tag $image:$VERSION $image:$tag
docker push $image:$tag
echo "Pushed $image:$tag"
curl -X PATCH --fail -H "Content-type: application/json" -H "Authorization: JWT $jwt" -d "$readme" "https://hub.docker.com/v2/repositories/$image"
done;
done
10 changes: 9 additions & 1 deletion bin/release/verifyConditions.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#!/bin/bash

docker login -u $DOCKER_REGISTRY_USER -p $DOCKER_REGISTRY_PASSWORD
set -e

docker login -u $DOCKER_REGISTRY_USER -p $DOCKER_REGISTRY_PASSWORD

AUTH_BODY='{"username":"'"$DOCKER_REGISTRY_USER"'","password":"'"$DOCKER_REGISTRY_PASSWORD"'"}'

response=$(curl -XPOST --fail -H "Content-type: application/json" -d $AUTH_BODY 'https://hub.docker.com/v2/users/login')

echo $response | jq -r .token >> .dockerhub.jwt

0 comments on commit c30c28d

Please sign in to comment.