Skip to content

Commit 5f21606

Browse files
Changed buildx to GH action (#170)
* Changed buildx to GH action * Fixed missing brackets * Splited build and release into to separate steps
1 parent eacd1e0 commit 5f21606

File tree

1 file changed

+18
-28
lines changed

1 file changed

+18
-28
lines changed

.github/workflows/build-docker.yml

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,41 +47,31 @@ jobs:
4747
echo "Status: ${{ steps.buildx.outputs.status }}"
4848
echo "Flags: ${{ steps.buildx.outputs.flags }}"
4949
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
50-
- name: Prepare
51-
id: prepare
52-
run: |
53-
DOCKER_IMAGE=toncenter/ton-http-api
54-
55-
if ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
56-
then
57-
DOCKER_PLATFORMS=linux/amd64,linux/arm64
58-
else
59-
DOCKER_PLATFORMS=linux/amd64,linux/arm64
60-
fi
61-
VERSION=${{ needs.set_version.outputs.version }}
62-
63-
TAGS="-t ${DOCKER_IMAGE}:${VERSION} -t ${DOCKER_IMAGE}:latest"
64-
65-
echo "docker_image=${DOCKER_IMAGE}" >> $GITHUB_OUTPUT
66-
echo "version=${VERSION}" >> $GITHUB_OUTPUT
67-
echo "buildx_args=--platform ${DOCKER_PLATFORMS} --no-cache ${TAGS} --file ton-http-api/.docker/Dockerfile ton-http-api" >> $GITHUB_OUTPUT
6850
- name: Login to DockerHub
69-
if: success() && github.repository == 'toncenter/ton-http-api' && github.event_name == 'push' && github.ref == 'refs/heads/master'
51+
if: success()
7052
uses: docker/login-action@v3
7153
with:
7254
username: ${{ secrets.DOCKER_USERNAME }}
7355
password: ${{ secrets.DOCKER_PASSWORD }}
7456
- name: Docker Buildx (build)
7557
if: success() && !(github.repository == 'toncenter/ton-http-api' && github.event_name == 'push' && github.ref == 'refs/heads/master')
76-
run: |
77-
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes
78-
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
79-
- name: Docker Buildx (push)
80-
if: success() && github.repository == 'toncenter/ton-http-api' && github.event_name == 'push' && github.ref == 'refs/heads/master'
81-
run: |
82-
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes
83-
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
58+
uses: docker/build-push-action@v6
59+
with:
60+
platforms: linux/amd64,linux/arm64
61+
push: false
62+
context: ./ton-http-api
63+
file: ./ton-http-api/.docker/Dockerfile
64+
tags: toncenter/ton-http-api:${{ needs.set_version.outputs.version }}
65+
- name: Docker Buildx (build and push)
66+
if: success() && (github.repository == 'toncenter/ton-http-api' && github.event_name == 'push' && github.ref == 'refs/heads/master')
67+
uses: docker/build-push-action@v6
68+
with:
69+
platforms: linux/amd64,linux/arm64
70+
push: true
71+
context: ./ton-http-api
72+
file: ./ton-http-api/.docker/Dockerfile
73+
tags: toncenter/ton-http-api:${{ needs.set_version.outputs.version }},toncenter/ton-http-api:latest
8474
- name: Inspect image
8575
if: always() && github.repository == 'toncenter/ton-http-api' && github.event_name == 'push' && github.ref == 'refs/heads/master'
8676
run: |
87-
docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
77+
docker buildx imagetools inspect toncenter/ton-http-api:${{ steps.prepare.outputs.version }}

0 commit comments

Comments
 (0)