Merge pull request #74 from awaismohammad23/main #8
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 Compose for Production | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up environment | |
run: | | |
echo "PORT=${{ secrets.PORT }}" >> backend/.env | |
echo "DB=${{ secrets.DB }}" >> backend/.env | |
echo "SECRET=${{ secrets.SECRET }}" >> backend/.env | |
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> backend/.env | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to Docker Hub | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
- name: Build and Push Docker Compose for Backend | |
run: | | |
version="v1.$GITHUB_RUN_NUMBER" | |
docker-compose -f docker-compose-ci.yaml build backend | |
docker tag virtual-horizon_backend:latest vacaramin/virtual-horizon-backend:$version | |
docker tag virtual-horizon_backend:latest vacaramin/virtual-horizon-backend:latest | |
docker push vacaramin/virtual-horizon-backend:$version | |
docker push vacaramin/virtual-horizon-backend:latest | |
- name: Build and Push Docker Compose for Frontend | |
run: | | |
version="v1.$GITHUB_RUN_NUMBER" | |
docker-compose -f docker-compose-ci.yaml build frontend | |
docker tag virtual-horizon_frontend:latest vacaramin/virtual-horizon-frontend:$version | |
docker tag virtual-horizon_frontend:latest vacaramin/virtual-horizon-frontend:latest | |
docker push vacaramin/virtual-horizon-frontend:$version | |
docker push vacaramin/virtual-horizon-frontend:latest |