Moved values out to .env #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Docker Image | |
on: | |
push: | |
branches: | |
- ethstats-client # This triggers the workflow on a push to the 'ethstats-client' branch | |
pull_request: | |
branches: | |
- ethstats-client # Also triggers on pull requests to the 'ethstats-client' branch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
# Step 2: Install Docker Compose | |
- name: Install Docker Compose | |
run: sudo apt-get update && sudo apt-get install -y docker-compose | |
# Step 3: Set up Docker Buildx | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# Step 4: Log in to DockerHub using the secrets | |
- name: Log in to DockerHub | |
run: echo "${{ secrets.TEST_DOCKERHUB_PAT }}" | docker login --username "${{ vars.TEST_DOCKERHUB_USERNAME }}" --password-stdin | |
# Step 5: Build the Docker image using docker-compose | |
- name: Build Docker image | |
run: docker-compose -f docker-compose-client.yml build | |
# Step 6: Push the Docker image to DockerHub using docker-compose | |
- name: Push Docker image | |
run: docker-compose -f docker-compose-client.yml push |