Skip to content

CI Deployments

CI Deployments #3

Workflow file for this run

name: Build and publish Docker image and deply to AWS EB
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Docker login and build
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t mohamedshawky/react-test -f ./client/Dockerfile.dev ./client
docker run -e CI=true mohamedshawky/react-test npm test
- name: build and push images
run: |
docker build -t mohamedshawky/multi-client ./client
docker build -t mohamedshawky/multi-nginx ./nginx
docker build -t mohamedshawky/multi-server ./server
docker build -t mohamedshawky/multi-worker ./worker
docker login -u mohamedshawky -p ${{ secrets.DOCKER_HUB_TOKEN }}
docker push mohamedshawky/multi-client
docker push mohamedshawky/multi-nginx
docker push mohamedshawky/multi-server
docker push mohamedshawky/multi-worker
- name: Generate deployment package
run: zip -r deploy.zip . -x '*.git*'
- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v18
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY }}
aws_secret_key: ${{ secrets.AWS_SECRET_KEY }}
application_name: multi-docker
environment_name: Multi-docker-env
existing_bucket_name: elasticbeanstalk-eu-central-1-597710854260
region: eu-central-1
version_label: ${{ github.sha }}
deployment_package: deploy.zip