Merge pull request #63 from DDD-Community/feature/dvh-fallback #23
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
name: Deploy to AWS EC2 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set .ENV file | |
run: | | |
echo "API_HOST=${{ secrets.API_HOST }}" >> .env | |
echo "NEXT_PUBLIC_GA_ID=${{ secrets.PUBLIC_GA_ID }}" >> .env | |
- 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: self-hosted | |
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 3000:3000 --name polabo-fe sonny2024/polabo-fe:latest |