From 6d940af48eb959b890102fbea2556eb75df18eb5 Mon Sep 17 00:00:00 2001 From: Siratee K Date: Thu, 14 Mar 2024 23:17:10 +0700 Subject: [PATCH] fix: Add Dockerfile --- .github/workflows/build-and-push.yml | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/build-and-push.yml diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml new file mode 100644 index 0000000..7641c51 --- /dev/null +++ b/.github/workflows/build-and-push.yml @@ -0,0 +1,37 @@ +name: Build Docker Image + +on: + push: + tags: + - '*' + +jobs: + build-docker-image: + runs-on: ubuntu-latest + steps: + # Fetch all repository details (Including tag for semver). + - uses: actions/checkout@v3 + + # Login to DockerHub by using the credentials. + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Setup BuildX + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + # Build Docker Image and push to docker hub. + - name: Build and push Docker image + uses: docker/build-push-action@v5.1.0 + with: + context: . + push: true + tags: ${{ format('ghcr.io/resource-aware-jds/example-dedicated-repo:{0}', github.ref_name) }},ghcr.io/resource-aware-jds/example-dedicated-repo:latest + github-token: ${{ secrets.GITHUB_TOKEN }} + platforms: | + linux/amd64 + linux/arm64