-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
03f8506
commit 3ac89ea
Showing
1 changed file
with
49 additions
and
0 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,49 @@ | ||
name: Build and Push Docker Images | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
docker: | ||
image: docker:latest | ||
options: >- | ||
--network=host | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push frontend image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./frontend | ||
push: true | ||
tags: ${{ secrets.DOCKER_USERNAME }}/booksby-frontend:latest | ||
build-args: | | ||
REACT_APP_BACKEND_URL=${{ vars.REACT_APP_BACKEND_URL }} | ||
- name: Build and push backend image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./backend | ||
push: true | ||
tags: ${{ secrets.DOCKER_USERNAME }}/booksby-backend:latest | ||
build-args: | | ||
FRONTEND_URL=${{ vars.FRONTEND_URL }} | ||