Update Dockerfile #9
Workflow file for this run
This file contains hidden or 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: Frontend CI/CD | |
| on: | |
| push: | |
| branches: [ feat/#20 ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| # env: | |
| # REACT_APP_API_URL: ${{ secrets.REACT_APP_API_URL }} | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18 | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install | |
| - name: Build project | |
| run: CI=false yarn build | |
| - name: Docker build | |
| run: docker build -t ${{ secrets.DOCKER_USERNAME }}/nextlevel-front -f Dockerfile . | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Push to Docker Hub | |
| run: docker push ${{ secrets.DOCKER_USERNAME }}/nextlevel-front | |
| ssh: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: ssh | |
| uses: appleboy/ssh-action@v0.1.6 | |
| with: | |
| host: ${{ secrets.SERVER_HOST }} | |
| username: ${{ secrets.SERVER_USERNAME }} | |
| key: ${{ secrets.SERVER_KEY }} | |
| port: 22 | |
| script: | | |
| docker stop springboot nginx front | |
| docker rm springboot nginx front | |
| docker rmi springboot | |
| docker rmi nginx | |
| docker rmi front | |
| docker pull ${{ secrets.DOCKERHUB_USERNAME }}/nextlevel-springboot:latest | |
| docker pull ${{ secrets.DOCKERHUB_USERNAME }}/nextlevel-nginx:latest | |
| docker pull ${{ secrets.DOCKERHUB_USERNAME }}/nextlevel-front:latest | |
| docker-compose up -d |