From 4565192ab0e693d2c0be3e73ac9ec20d246ca5a8 Mon Sep 17 00:00:00 2001 From: Kyle Jackson Date: Mon, 5 Aug 2024 21:33:41 +1000 Subject: [PATCH] added docker image --- .github/workflows/build-images.yml | 38 ++++++++++++++++++++++++++++++ build/miner/Dockerfile | 10 ++++++++ 2 files changed, 48 insertions(+) create mode 100644 .github/workflows/build-images.yml create mode 100644 build/miner/Dockerfile diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml new file mode 100644 index 0000000..13953e2 --- /dev/null +++ b/.github/workflows/build-images.yml @@ -0,0 +1,38 @@ +name: Build images + +on: + push: + branches: + - main + +jobs: + build-miner-image: + name: Build Miner Image + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup QEMU + uses: docker/setup-qemu-action@v3 + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Azure Container Registry + uses: docker/login-action@v3 + with: + registry: "wizedkyle.azurecr.io" + username: ${{ secrets.ACR_USERNAME }} + password: ${{ secrets.ACR_PASSWORD }} + + - name: Build and push image + uses: docker/build-push-action@v5 + with: + context: . + push: true + file: build/miner/Dockerfile + platforms: linux/amd64 + tags: + wizedkyle.azurecr.io/miner:latest + wizedkyle.azurecr.io/miner:1.0.${{ github.run_id }} \ No newline at end of file diff --git a/build/miner/Dockerfile b/build/miner/Dockerfile new file mode 100644 index 0000000..6240145 --- /dev/null +++ b/build/miner/Dockerfile @@ -0,0 +1,10 @@ +FROM golang:1.22.5-alpine3.20 + +WORKDIR /go/src/miner + +COPY . /go/src/miner + +RUN go get ./... +RUN go build ./cmd/miner + +ENTRYPOINT ["./miner"] \ No newline at end of file