diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5488582..7c63073 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -35,7 +35,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2.9.1 - + - name: Login to DockerHub uses: docker/login-action@v2.2.0 with: @@ -45,7 +45,7 @@ jobs: - name: Build and push uses: docker/build-push-action@v4 with: - file: ../../Dockerfile + file: ./Dockerfile push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_PROD_REPONAME }}:0.0.1 @@ -59,9 +59,9 @@ jobs: with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USERNAME }} - key: ${{ secrets.SSH_KEY }} + password: ${{ secrets.SSH_PASSWORD }} port: ${{ 22 }} script: | docker compose down docker image prune -a - docker compose up + docker compose up -d diff --git a/Dockerfile b/Dockerfile index 494ecaa..af1cf2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,14 @@ -FROM openjdk:17 -COPY /build/libs/puddy-0.0.1-SNAPSHOT.jar app.jar -ENTRYPOINT ["java", "-jar", "app.jar", "--spring.profiles.active=prod"] \ No newline at end of file +# FROM openjdk:17 +# WORKDIR /app +# COPY ./build/libs/puddy-0.0.1-SNAPSHOT.jar app.jar +# ENTRYPOINT ["java", "-jar", "app.jar", "--spring.profiles.active=prod"] + +FROM gradle:8.5-jdk17 AS builder +COPY . /usr/src +WORKDIR /usr/src +RUN gradle wrapper --gradle-version 8.5 +RUN ./gradlew clean build -x test + +FROM openjdk:17-jdk-alpine +COPY --from=builder /usr/src/build/libs/puddy-0.0.1-SNAPSHOT.jar /usr/app/app.jar +ENTRYPOINT ["java", "-jar", "/usr/app/app.jar", "--spring.profiles.active=prod"]