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