Skip to content

Commit

Permalink
Updating the docker deployment github actions yml
Browse files Browse the repository at this point in the history
Adding the dockercompose file
  • Loading branch information
san-est committed Jun 12, 2024
1 parent e0c8f11 commit 2f30750
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 18 deletions.
50 changes: 32 additions & 18 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,41 @@
name: Build & Push Docker image for project
name: Docker Image Build and Push to ghcr

on:
push:
types: [labeled]
pull_request:
types: [labeled]
branches: [ "main" ]
types: [ labeled ]

jobs:
# Adding this so that I can test my jobs and run workflows manually from the Actions tab in the repository
workflow_dispatch:

build-and-push:
env:
REGISTRY: ghcr.io
IMAGE_NAME: san-est/go-ethereum-devops

jobs:
build-and-push:
if: ${{ github.event.label.name == 'CI:Build' }}
runs-on: ubuntu-latest
if: ${{ (github.event_name == 'pull_request' && github.event.label.name == 'CI:Build') }}

permissions:
contents: read
packages: write
id-token: write

steps:
- uses: actions/checkout@v4
- name: Login to Github Container repository
- uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Docker image
run: docker build . --file Dockerfile --tag go-etherium-devops:$(date +%s)
- name: Push Docker image to Github container repository
run: docker push ghcr.io/go-etherium-devops:$(date +%s)

- name: Login to registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push docker image
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.run_number }}
13 changes: 13 additions & 0 deletions dockercompose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3.8'

services:
geth:
image: san-est/go-ethereum-devops:latest
#ports were grabbed from the docker quick start in the README within https://github.com/ethereum/go-ethereum
ports:
- "8545:8545"
- "30303:30303"
volumes:
- ./data:/root/.ethereum
#running the node in dev mode, enabling RPC server, binding it to all availible networks, sets on which port RPC should listen to and availible APIs.
command: ["--dev", "--http", "--http.addr", "0.0.0.0", "--http.port", "8545", "--http.api", "eth,net,web3"]

0 comments on commit 2f30750

Please sign in to comment.