diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bbb2e5e466..ae0e4fd417 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,25 +12,27 @@ jobs: packages: write env: - IMAGE_VERSION: "${{ github.event.release.tag_name }}" - + RELEASE_VERSION: "${{ github.event.release.tag_name }}" steps: - uses: actions/checkout@v3 with: fetch-depth: 0 + # limit docker push image concurrency to 1 # to avoid github package return 429 ratelimit error - name: Set docker upload concurrent run: | echo $'{"max-concurrent-uploads": 1}' | sudo dd status=none of=/etc/docker/daemon.json sudo service docker restart + - name: Log in to the Container registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Log in to Docker Hub uses: docker/login-action@v2 with: @@ -39,20 +41,12 @@ jobs: - name: build ghcr docker image run: make build-docker-images - env: - IMAGE_NAME: "ghcr.io/open-telemetry/demo" - name: push ghcr image run: make push-docker-images - env: - IMAGE_NAME: "ghcr.io/open-telemetry/demo" - name: build dockerhub docker image run: make build-docker-images - env: - IMAGE_NAME: "otel/demo" - name: push dockerhub image run: make push-docker-images - env: - IMAGE_NAME: "otel/demo" diff --git a/Makefile b/Makefile index 47b5347b17..4745761b88 100644 --- a/Makefile +++ b/Makefile @@ -58,10 +58,21 @@ install-tools: $(MISSPELL) npm install @echo "All tools installed" -.PHONY: build-docker-images -build-docker-images: - docker compose -f docker-compose.yml build +.PHONY: build-and-push-dockerhub +build-and-push-dockerhub: + docker compose --env-file .dockerhub.env -f docker-compose.yml build + docker compose --env-file .dockerhub.env -f docker-compose.yml pusd -.PHONY: push-docker-images -push-docker-images: - docker compose -f docker-compose.yml push +.PHONY: build-and-push-ghcr +build-and-push-ghcr: + docker compose --env-file .ghcr.env -f docker-compose.yml build + docker compose --env-file .ghcr.env -f docker-compose.yml push + +.PHONY: build-env-file +build-env-file: + cp .env .dockerhub.env + sed -i '/IMAGE_VERSION=.*/c\IMAGE_VERSION=${RELEASE_VERSION}' .dockerhub.env + sed -i '/IMAGE_NAME=.*/c\IMAGE_NAME=otel/demo' .dockerhub.env + cp .env .ghcr.env + sed -i '/IMAGE_VERSION=.*/c\IMAGE_VERSION=${RELEASE_VERSION}' .ghcr.env + sed -i '/IMAGE_NAME=.*/c\IMAGE_NAME=ghcr.io/open-telemetry/demo' .ghcr.env