diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 05cee1c..9a85ca5 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -48,4 +48,4 @@ jobs: password: ${{ secrets.VPS_PASSWORD }} script: | cd /srv/Server-Monitoring-Tool && - sudo ./update.sh + sudo ./update2.sh diff --git a/Dockerfile b/Dockerfile index 4acf12c..5f0f338 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,16 @@ FROM maven:3.9.6-amazoncorretto-21 AS build + +ARG DB_URL +ARG DB_USERNAME +ARG DB_PASSWORD + +ENV DB_URL=$DB_URL +ENV DB_USERNAME=$DB_USERNAME +ENV DB_PASSWORD=$DB_PASSWORD + WORKDIR /build COPY . . -RUN mvn clean install -Dmaven.test.skip=true +RUN mvn clean install FROM openjdk:21 COPY --from=build /build/target/DockerMonitor-0.0.1-SNAPSHOT.jar /usr/local/lib/DockerMonitor-0.0.1-SNAPSHOT.jar diff --git a/docker-compose.yml b/docker-compose.yml index 8a07b63..0ea9ad1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,19 @@ +version: '3.8' + services: servermonitor-backend: image: servermonitor-backend:latest build: context: . dockerfile: ./Dockerfile + args: + DB_URL: ${DB_URL} + DB_USERNAME: ${DB_USER} + DB_PASSWORD: ${DB_PASSWORD} + environment: + - DB_URL=${DB_URL} + - DB_USERNAME=${DB_USER} + - DB_PASSWORD=${DB_PASSWORD} container_name: servermonitor-backend ports: - "8052:8052" diff --git a/update.sh b/update.sh deleted file mode 100755 index b47d394..0000000 --- a/update.sh +++ /dev/null @@ -1 +0,0 @@ -sudo git pull -f && sudo docker compose down && sudo docker compose up -d --build