From aec0fc96c1449823d169f6debce28d1c2abd4939 Mon Sep 17 00:00:00 2001 From: Nikola Date: Sun, 5 Jan 2025 18:31:12 +0000 Subject: [PATCH] add build-push and compose yml files --- .github/workflows/build-push.yml | 37 ++++++++++++++++++++++++++++ .github/workflows/docker-compose.yml | 9 +++++++ build/Dockerfile | 20 +++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 .github/workflows/build-push.yml create mode 100644 .github/workflows/docker-compose.yml create mode 100644 build/Dockerfile diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml new file mode 100644 index 0000000000..00de2ad905 --- /dev/null +++ b/.github/workflows/build-push.yml @@ -0,0 +1,37 @@ +name: Build and Push Docker Image + +name: Build and Push Docker Image + +on: + pull_request: + types: [closed] + branches: + - main + labels: + - CI:Build + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PAT }} + + - name: Set ENV Variable for Docker Compose + run: echo "DOCKER_HUB_USERNAME=${{ secrets.DOCKER_HUB_USERNAME }}" >> $GITHUB_ENV + + - name: Build and Push Docker Image + run: | + docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/go-ethereum:latest . + docker push ${{ secrets.DOCKER_HUB_USERNAME }}/go-ethereum:latest + diff --git a/.github/workflows/docker-compose.yml b/.github/workflows/docker-compose.yml new file mode 100644 index 0000000000..3b69d1cb9c --- /dev/null +++ b/.github/workflows/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3.8' + +services: + geth: + image: "${{ secrets.DOCKER_HUB_USERNAME }}/go-ethereum:latest" + ports: + - "8545:8545" + - "30303:30303" + diff --git a/build/Dockerfile b/build/Dockerfile new file mode 100644 index 0000000000..b19dbe3147 --- /dev/null +++ b/build/Dockerfile @@ -0,0 +1,20 @@ +FROM golang:1.23-alpine + +# Install dependencies +RUN apk add --no-cache ca-certificates + +# Set the working directory +WORKDIR /go-ethereum + +# Copy the source code +COPY . . + +# Build Geth +RUN make geth + +# Expose necessary ports +EXPOSE 8545 8546 30303 + +# Run Geth +CMD ["build/bin/geth"] +