feat: changed Dockerfile, docker-compose.yml

This commit is contained in:
filippo-ferrari 2024-09-06 20:37:33 +02:00
parent 9a05cbd665
commit 8a1bec59ff

View file

@ -25,22 +25,22 @@ jobs:
with: with:
ssh-private-key: ${{ secrets.SSH_KEY }} ssh-private-key: ${{ secrets.SSH_KEY }}
- name: Copy files to server - name: Copy Docker files to server
run: | run: |
scp -o StrictHostKeyChecking=no docker-compose.yml Dockerfile ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/home/${{ secrets.SSH_USER }}/munera/ scp -o StrictHostKeyChecking=no docker-compose.yml Dockerfile ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/home/effe/munera/
scp -o StrictHostKeyChecking=no target/munera-1.0-SNAPSHOT.jar ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/home/${{ secrets.SSH_USER }}/munera/
- name: Deploy using Docker Compose - name: Deploy Docker containers
run: | run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF' ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF'
cd /home/${{ secrets.SSH_USER }}/munera cd /home/effe/munera
# Stop and remove only the specific application container # Stop and remove existing containers for vaadin-app only
docker stop vaadin-app || true docker-compose stop vaadin-app || true
docker rm vaadin-app || true docker-compose rm -f vaadin-app || true
# Build and start the containers (including the database container) # Rebuild and restart containers using docker-compose
docker-compose up -d --build docker-compose up -d --build
EOF EOF
env: env:
DB_ADDRESS: ${{ secrets.DB_ADDRESS }} DB_ADDRESS: ${{ secrets.DB_ADDRESS }}