Fixed dependencies #60
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: Deployment | |
on: | |
push: | |
branches: | |
- "master" | |
jobs: | |
dockerize: | |
name: Dockerize | |
runs-on: ubuntu-latest | |
env: | |
DO_PASSWORD: ${{ secrets.DO_PASSWORD }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Log in to Docker Hub | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Install | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Build, tag and push | |
run: | | |
cd build | |
docker build -t ozziest/bookstore:latest . | |
docker push ozziest/bookstore:latest | |
- name: Deployment to production | |
run: sshpass -p "$DO_PASSWORD" ssh -o StrictHostKeyChecking=no -o PreferredAuthentications=password [email protected] 'cd /home/composes/bookstore && docker compose pull && docker compose down && docker compose up -d && docker system prune --force' |