Skip to content

Commit

Permalink
chore: Improve docker-compose.yml generation in deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex authored and alepefe committed Aug 28, 2024
1 parent 3bfb3f7 commit 140d533
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,28 +192,30 @@ jobs:
ECR_REPOSITORY_API: ${{ secrets.TF_API_REPOSITORY_NAME }}
IMAGE_TAG: ${{ steps.extract_branch.outputs.branch == 'main' && 'production' || steps.extract_branch.outputs.branch }}
run: |
echo "services:" >> docker-compose.yml
echo " client:" >> docker-compose.yml
echo " image: $ECR_REGISTRY/$ECR_REPOSITORY_CLIENT:$IMAGE_TAG" >> docker-compose.yml
echo " restart: always" >> docker-compose.yml
echo " ports:" >> docker-compose.yml
echo " - 3000:3000" >> docker-compose.yml
echo " api:" >> docker-compose.yml
echo " image: $ECR_REGISTRY/$ECR_REPOSITORY_API:$IMAGE_TAG" >> docker-compose.yml
echo " restart: always" >> docker-compose.yml
echo " ports:" >> docker-compose.yml
echo " - 4000:4000" >> docker-compose.yml
echo " nginx:" >> docker-compose.yml
echo " image: nginx" >> docker-compose.yml
echo " restart: always" >> docker-compose.yml
echo " volumes:" >> docker-compose.yml
echo " - ./proxy/conf.d:/etc/nginx/conf.d" >> docker-compose.yml
echo " - \"\${EB_LOG_BASE_DIR}/nginx:/var/log/nginx\"" >> docker-compose.yml
echo " ports:" >> docker-compose.yml
echo " - 80:80" >> docker-compose.yml
echo " depends_on:" >> docker-compose.yml
echo " - api" >> docker-compose.yml
echo " - client" >> docker-compose.yml
cat <<EOF >> docker-compose.yml
services:
client:
image: $ECR_REGISTRY/$ECR_REPOSITORY_CLIENT:$IMAGE_TAG
restart: always
ports:
- 3000:3000
api:
image: $ECR_REGISTRY/$ECR_REPOSITORY_API:$IMAGE_TAG
restart: always
ports:
- 4000:4000
nginx:
image: nginx
restart: always
volumes:
- ./proxy/conf.d:/etc/nginx/conf.d
- "\${EB_LOG_BASE_DIR}/nginx:/var/log/nginx"
ports:
- 80:80
depends_on:
- api
- client
EOF
- name: Upload Docker Compose File as Artifact
uses: actions/upload-artifact@v2
Expand Down

0 comments on commit 140d533

Please sign in to comment.