-
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
1 parent
ec98c26
commit 4ce701e
Showing
1 changed file
with
32 additions
and
0 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,32 @@ | ||
name: Deploy to AWS EC2 | ||
|
||
on: | ||
push: | ||
branches: | ||
- feature/deploy | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Build docker image | ||
run: docker build -t sonny2024/polabo-fe . | ||
- name: Login to DockerHub | ||
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin | ||
- name: Push to DockerHub | ||
run: docker push sonny2024/polabo-fe:latest | ||
|
||
deploy: | ||
needs: build | ||
runs-on: ip-172-31-6-84 | ||
|
||
steps: | ||
- name: Pull from DockerHub | ||
run: docker pull sonny2024/polabo-fe:latest | ||
- name: Delete existing container | ||
run: docker rm -f polabo-fe || true | ||
- name: Run container | ||
run: docker run -d -p 80:80 --name polabo-fe sonny2024/polabo-fe:latest |