feat: changed Dockerfile, docker-compose.yml
This commit is contained in:
parent
8a1bec59ff
commit
17f8642a8b
2 changed files with 11 additions and 19 deletions
16
.github/workflows/deploy.yml
vendored
16
.github/workflows/deploy.yml
vendored
|
@ -25,22 +25,16 @@ jobs:
|
|||
with:
|
||||
ssh-private-key: ${{ secrets.SSH_KEY }}
|
||||
|
||||
- name: Copy Docker files to server
|
||||
- name: Deploy Docker Compose and Dockerfile
|
||||
run: |
|
||||
scp -o StrictHostKeyChecking=no docker-compose.yml Dockerfile ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/home/effe/munera/
|
||||
scp -o StrictHostKeyChecking=no docker-compose.yml Dockerfile ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/home/${{ secrets.SSH_USER }}/munera/
|
||||
|
||||
- name: Deploy Docker containers
|
||||
- name: Deploy Docker image and run containers
|
||||
run: |
|
||||
ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF'
|
||||
cd /home/effe/munera
|
||||
|
||||
# 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
|
||||
cd /home/${{ secrets.SSH_USER }}/munera
|
||||
docker-compose down --remove-orphans || true
|
||||
docker-compose up -d --build
|
||||
|
||||
EOF
|
||||
env:
|
||||
DB_ADDRESS: ${{ secrets.DB_ADDRESS }}
|
||||
|
|
14
Dockerfile
14
Dockerfile
|
@ -1,19 +1,17 @@
|
|||
# Use a Maven image with OpenJDK 22 to build the JAR
|
||||
# Use a Maven image to build the JAR
|
||||
FROM maven:3.9.4-eclipse-temurin-21-alpine AS build
|
||||
|
||||
# Install Node.js (needed for Vaadin frontend tooling)
|
||||
RUN apk add --no-cache nodejs npm
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the source code into the container
|
||||
COPY . .
|
||||
# Copy the pom.xml and the source code
|
||||
COPY pom.xml ./
|
||||
COPY src ./src
|
||||
|
||||
# Build the JAR file
|
||||
# Package the application
|
||||
RUN mvn clean package -DskipTests
|
||||
|
||||
# Use a lightweight image with OpenJDK 22 to run the JAR
|
||||
# Use an OpenJDK image to run the JAR
|
||||
FROM openjdk:22-jdk-slim
|
||||
|
||||
# Set the working directory
|
||||
|
|
Loading…
Reference in a new issue