mirror of
https://github.com/mempool/mempool.git
synced 2026-08-13 12:33:11 +02:00
Login only if needed
This commit is contained in:
parent
4afe4be5e5
commit
1205d15920
1 changed files with 35 additions and 10 deletions
45
.github/workflows/docker.yml
vendored
45
.github/workflows/docker.yml
vendored
|
|
@ -83,6 +83,9 @@ jobs:
|
|||
|
||||
|
||||
- name: Login to Docker for building
|
||||
if: |
|
||||
github.event_name == 'push' ||
|
||||
(github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'docker-test'))
|
||||
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
||||
|
||||
- name: Checkout project
|
||||
|
|
@ -139,16 +142,38 @@ jobs:
|
|||
- name: Run Docker buildx for ${{ matrix.service }} against tag
|
||||
id: docker-build
|
||||
run: |
|
||||
docker buildx build \
|
||||
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||
--cache-to "type=local,dest=/tmp/.buildx-cache,mode=max" \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--tag ${{ secrets.DOCKER_HUB_USER }}/${{ matrix.service }}:$TAG \
|
||||
--build-context rustgbt=./rust \
|
||||
--build-context backend=./backend \
|
||||
--output "type=registry,push=true" \
|
||||
--build-arg commitHash=$SHORT_SHA \
|
||||
./${{ matrix.service }}/
|
||||
# For docker-test label PRs, build locally without pushing
|
||||
IS_DOCKER_TEST=false
|
||||
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||
LABELS="${{ join(github.event.pull_request.labels.*.name, ' ') }}"
|
||||
if echo "$LABELS" | grep -q "docker-test"; then
|
||||
IS_DOCKER_TEST=true
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$IS_DOCKER_TEST" = "true" ]; then
|
||||
docker buildx build \
|
||||
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||
--cache-to "type=local,dest=/tmp/.buildx-cache,mode=max" \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--tag ${{ secrets.DOCKER_HUB_USER }}/${{ matrix.service }}:$TAG \
|
||||
--build-context rustgbt=./rust \
|
||||
--build-context backend=./backend \
|
||||
--output "type=image,push=false" \
|
||||
--build-arg commitHash=$SHORT_SHA \
|
||||
./${{ matrix.service }}/
|
||||
else
|
||||
docker buildx build \
|
||||
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||
--cache-to "type=local,dest=/tmp/.buildx-cache,mode=max" \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--tag ${{ secrets.DOCKER_HUB_USER }}/${{ matrix.service }}:$TAG \
|
||||
--build-context rustgbt=./rust \
|
||||
--build-context backend=./backend \
|
||||
--output "type=registry,push=true" \
|
||||
--build-arg commitHash=$SHORT_SHA \
|
||||
./${{ matrix.service }}/
|
||||
fi
|
||||
|
||||
tag-latest:
|
||||
needs: build
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue