-
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
Showing
3 changed files
with
63 additions
and
2 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,61 @@ | ||
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 |
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
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