Revert "Adding "remove/add" buttons in resume step" #122
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: Build and Deploy to EC2 | |
on: | |
push: | |
branches: | |
- main | |
env: | |
REGISTRY: ${{ secrets.DOCKERHUB_USERNAME }}/keiko-bot | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Docker image | |
run: docker buildx build --build-arg=APPLICATION_ENVIRONMENT=prod -t ${{ env.REGISTRY }}:latest . | |
- name: Push Docker image | |
run: docker push ${{ env.REGISTRY }}:latest | |
deploy: | |
runs-on: self-hosted | |
needs: build | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Remove docker container | |
run: docker rm -f keiko-bot || true | |
- name: Remove docker image | |
run: docker rmi ${{ env.REGISTRY }}:latest || true | |
- name: Pull image from docker hub | |
run: docker pull ${{ env.REGISTRY }}:latest | |
- name: Run docker container | |
run: docker run -d -p 5000:5000 -p 8000:8000 --name keiko-bot --restart unless-stopped ${{ env.REGISTRY }}:latest |