fix : social register #132
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: DICE FRONTEND CI/CD | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
DOCKER_BUILD_PUSH: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to Docker Hub | |
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker image | |
run: | | |
docker buildx build --platform linux/arm64,linux/amd64 -t pinomaker/dice-frontend:latest-arm64 -t pinomaker/dice-frontend:latest-amd64 --file Dockerfile . --push | |
DOCKER_PULL_RUN: | |
runs-on: ubuntu-latest | |
needs: DOCKER_BUILD_PUSH | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Initialize Known Hosts | |
run: | | |
mkdir -p ~/.ssh | |
touch ~/.ssh/known_hosts | |
ssh-keyscan ${{ secrets.EC2_HOST_DEV }} >> ~/.ssh/known_hosts | |
- name: Set Permissions for Private Key | |
run: | | |
echo "${{ secrets.DEPLOY_SSH_KEY }}" > $HOME/key.pem | |
chmod 400 $HOME/key.pem | |
- name: Run Docker | |
env: | |
SSH_PEM_KEY: ${{ secrets.DEPLOY_SSH_KEY }} | |
run: | | |
ssh -i $HOME/key.pem -o StrictHostKeyChecking=no ubuntu@${{ secrets.EC2_HOST_DEV }} "sudo docker container rm -f dice-frontend && sudo docker image rm pinomaker/dice-frontend:latest-amd64 && sudo docker pull pinomaker/dice-frontend:latest-amd64 && sudo docker run -d -p 8080:8080 --name dice-frontend pinomaker/dice-frontend:latest-amd64" |