Skip to content

frontend fug fix

frontend fug fix #59

name: Deploy Backend to Docker Hub and Elastic Beanstalk
on:
push:
branches:
- main
- backend
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.11.1'
- name: Build Docker image
run: |
docker build -t my-backend-app -f Dockerfile .
- name: Log in to Docker Hub
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
run: |
echo "$DOCKER_HUB_ACCESS_TOKEN" | docker login --username "$DOCKER_HUB_USERNAME" --password-stdin
- name: Tag Docker image
run: |
docker tag my-backend-app:latest amarjha01/electramart:latest
- name: Push Docker image to Docker Hub
run: |
docker push amarjha01/electramart:latest
# - name: Install AWS Elastic Beanstalk CLI
# run: |
# sudo pip install awsebcli
# - name: Prepare source bundle for Elastic Beanstalk
# run: |
# mkdir -p eb-deploy
# cp Dockerrun.aws.json eb-deploy/
# cp -r backend/* eb-deploy/
# cd eb-deploy
# zip -r ../app.zip .
# - name: Deploy to Elastic Beanstalk
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_REGION: ap-south-1
# run: |
# eb init -p docker my-backend-app --region $AWS_REGION
# eb use My-backend-app-env2
# eb deploy