From bf834220265ad52e354def37fe6ad31e4c2a095f Mon Sep 17 00:00:00 2001 From: ducnt131 <62016666+anhductn2001@users.noreply.github.com> Date: Sun, 22 Dec 2024 16:40:25 +0700 Subject: [PATCH] chore(ci): build and push image (#1292) --- .github/workflows/build_and_push_image.yml | 47 ++++++++++++++++++++++ Dockerfile | 10 +++++ 2 files changed, 57 insertions(+) create mode 100644 .github/workflows/build_and_push_image.yml create mode 100644 Dockerfile diff --git a/.github/workflows/build_and_push_image.yml b/.github/workflows/build_and_push_image.yml new file mode 100644 index 000000000..b600e6116 --- /dev/null +++ b/.github/workflows/build_and_push_image.yml @@ -0,0 +1,47 @@ +# This workflow pushes new grpc da images on every new commit on main. +# +# ghcr.io/dymensionxyz/dymint:latest +# ghcr.io/dymensionxyz/dymint:{SHORT_SHA} + +name: Push docker images +on: + push: + branches: + - main + +permissions: + contents: read + packages: write + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - + name: Check out the repo + uses: actions/checkout@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Create Docker Image Tag for vN.x branch + run: | + SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-8) + echo "DOCKER_IMAGE_TAG=${SHORT_SHA}" >> $GITHUB_ENV + - + name: Build and push + id: build_push_image + uses: docker/build-push-action@v3 + with: + file: Dockerfile + context: . + push: true + platforms: linux/amd64 + tags: | + ghcr.io/dymensionxyz/dymint:latest + ghcr.io/dymensionxyz/dymint:${{ env.DOCKER_IMAGE_TAG }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..073f6e665 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM golang:1.23.3-alpine3.19 + +WORKDIR /app + +COPY . . + +WORKDIR /app/da/grpc/mockserv/cmd + +# Command to run the executable +CMD ["go","run", "main.go"] \ No newline at end of file