From a00924500e5310883ccea82ab8af0e9b6c0bc2c8 Mon Sep 17 00:00:00 2001 From: GImbrailo Date: Mon, 17 Jun 2024 14:02:04 -0700 Subject: [PATCH 1/2] chore: initial commit of Dockerfile --- Dockerfile | 8 ++++++++ config.yaml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cfefebf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM golang:1.22-alpine3.20 +ADD . /octez-ecad-sc +WORKDIR /octez-ecad-sc + +RUN go build -o octez-ecad-sc + +ENTRYPOINT ["/octez-ecad-sc/octez-ecad-sc"] +CMD [ "-c", "/octez-ecad-sc/config.yaml" ] diff --git a/config.yaml b/config.yaml index 1804e6c..cf6479b 100644 --- a/config.yaml +++ b/config.yaml @@ -1,3 +1,3 @@ listen: :8080 -url: http://ghostnet.ecadinfra.com:8080 +url: https://ghostnet.ecadinfra.com chain_id: NetXnHfVqm9iesp From e4120f4289acc57292b7f3f3c54ba5c75ab8567f Mon Sep 17 00:00:00 2001 From: GImbrailo Date: Mon, 17 Jun 2024 14:44:31 -0700 Subject: [PATCH 2/2] chore: added workflow for docker build and publish --- .github/workflows/build.yaml | 63 ++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..50eaa0b --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,63 @@ +on: + push: + branches: + - "main" + tags: + - "v*" + - "rc*" + pull_request: + branches: + - "main" + +name: Test and publish + +permissions: + contents: write + deployments: write + issues: write + packages: write + +jobs: + build-and-publish: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up QEMU + id: qemu + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/ecadlabs/octez-ecad-sc + tags: | + type=ref,event=branch,suffix=-{{sha}} + type=ref,event=pr,suffix=-{{sha}} + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=raw,value=latest,enable={{is_default_branch}} + + - name: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}