feat: changed Dockerfile, docker-compose.yml
This commit is contained in:
parent
1b4abd03c0
commit
9a05cbd665
2 changed files with 18 additions and 9 deletions
22
.github/workflows/deploy.yml
vendored
22
.github/workflows/deploy.yml
vendored
|
@ -25,21 +25,25 @@ jobs:
|
||||||
with:
|
with:
|
||||||
ssh-private-key: ${{ secrets.SSH_KEY }}
|
ssh-private-key: ${{ secrets.SSH_KEY }}
|
||||||
|
|
||||||
- name: Deploy Docker image
|
- name: Copy 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/
|
||||||
|
|
||||||
|
- name: Deploy using Docker Compose
|
||||||
run: |
|
run: |
|
||||||
ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF'
|
ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF'
|
||||||
docker pull vaadin-app || true
|
cd /home/${{ secrets.SSH_USER }}/munera
|
||||||
|
|
||||||
|
# Stop and remove only the specific application container
|
||||||
docker stop vaadin-app || true
|
docker stop vaadin-app || true
|
||||||
docker rm vaadin-app || true
|
docker rm vaadin-app || true
|
||||||
docker run -d --name vaadin-app -p 8080:8080 \
|
|
||||||
-e DB_ADDRESS=${DB_ADDRESS} \
|
# Build and start the containers (including the database container)
|
||||||
-e DB_USER=${DB_USER} \
|
docker-compose up -d --build
|
||||||
-e DB_PASSWORD=${DB_PASSWORD} \
|
|
||||||
-e DB_NAME=${DB_NAME} \
|
|
||||||
vaadin-app
|
|
||||||
EOF
|
EOF
|
||||||
env:
|
env:
|
||||||
DB_ADDRESS: ${{ secrets.DB_ADDRESS }}
|
DB_ADDRESS: ${{ secrets.DB_ADDRESS }}
|
||||||
DB_USER: ${{ secrets.DB_USER }}
|
DB_USER: ${{ secrets.DB_USER }}
|
||||||
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
||||||
DB_NAME: ${{ secrets.DB_NAME }}
|
DB_NAME: ${{ secrets.DB_NAME }}
|
||||||
|
|
|
@ -21,3 +21,8 @@ services:
|
||||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||||
ports:
|
ports:
|
||||||
- "5432:5432"
|
- "5432:5432"
|
||||||
|
volumes:
|
||||||
|
- db_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db_data:
|
||||||
|
|
Loading…
Reference in a new issue