generated from bitcoin-sv/template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docker github action and fix builds
- Loading branch information
Showing
3 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Build and Push Docker Image | ||
|
||
# Trigger the workflow on push or pull request to the main branch | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Check out the repository code | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# Step 2: Set up Docker Buildx (for multi-platform builds, optional) | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# Step 3: Log in to Docker Hub using secrets | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
# Step 4: Build and push the Docker image | ||
- name: Build and push frontend Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./front # Build context (root directory, adjust if Dockerfile is elsewhere) | ||
file: ./front/Dockerfile # Path to Dockerfile | ||
push: ${{ github.event_name != 'pull_request' }} # Only push on push events, not PRs | ||
tags: | | ||
docker.io/bsvb/truth-machine-demo:${{ github.sha }} | ||
docker.io/bsvb/truth-machine:latest | ||
# Step 5: Build and push the backend Docker image | ||
- name: Build and push frontend Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./back # Build context (root directory, adjust if Dockerfile is elsewhere) | ||
file: ./back/Dockerfile # Path to Dockerfile | ||
push: ${{ github.event_name != 'pull_request' }} # Only push on push events, not PRs | ||
tags: | | ||
docker.io/bsvb/truth-machine:${{ github.sha }} | ||
docker.io/bsvb/truth-machine:latest | ||
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
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