From 5ab361be9bf96f3d7ecdd4a368e7c3773ab3f44a Mon Sep 17 00:00:00 2001 From: Ziedelth Date: Fri, 22 Dec 2023 11:10:39 +0100 Subject: [PATCH] Add docker-compose.yml and change to installDist --- .github/workflows/global_workflow.yml | 2 ++ Dockerfile | 6 +++--- build.gradle.kts | 4 ++++ docker-compose.yml | 25 +++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 docker-compose.yml diff --git a/.github/workflows/global_workflow.yml b/.github/workflows/global_workflow.yml index d6702519..33456a13 100644 --- a/.github/workflows/global_workflow.yml +++ b/.github/workflows/global_workflow.yml @@ -3,6 +3,8 @@ name: Global workflow on: pull_request: push: + branches: + - master jobs: test: diff --git a/Dockerfile b/Dockerfile index 72bc5521..259675d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM gradle:8.5.0-jdk21-jammy AS build COPY --chown=gradle:gradle . /app WORKDIR /app -RUN gradle build --no-daemon -x test +RUN gradle clean installDist FROM mcr.microsoft.com/playwright:v1.40.1-jammy ARG version=21.0.1.12-1 @@ -21,7 +21,7 @@ RUN set -eux; apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* # Copy app from build stage -COPY --from=build /app/build/libs/core-all.jar /app/core.jar +COPY --from=build /app/build/install/core /app COPY --from=build /app/hibernate.cfg.xml /app/hibernate.cfg.xml # Configure timezone and install necessary packages @@ -33,4 +33,4 @@ RUN apt-get update && \ WORKDIR /app EXPOSE 37100 -CMD ["java", "-jar", "core.jar"] \ No newline at end of file +CMD ["./bin/core"] \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 6814b7fe..e4c0dccb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -62,6 +62,10 @@ dependencies { testImplementation("com.h2database:h2:2.2.224") } +kotlin { + jvmToolchain(21) +} + tasks.jacocoTestReport { reports { xml.required = true diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..362c88c6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3.8' +services: + shikkanime-db: + image: postgres:16-alpine + restart: always + container_name: shikkanime-db + environment: + POSTGRES_PASSWORD: "mysecretpassword" + POSTGRES_USER: postgres + POSTGRES_DB: shikkanime + healthcheck: + test: [ "CMD", "pg_isready", "-U", "postgres" ] + shikkanime-core: + image: shikkanime-core:latest + ports: + - "37100:37100" + restart: on-failure + container_name: shikkanime-core + depends_on: + shikkanime-db: + condition: service_healthy + environment: + DATABASE_URL: jdbc:postgresql://shikkanime-db:5432/shikkanime + DATABASE_USERNAME: postgres + DATABASE_PASSWORD: "mysecretpassword" \ No newline at end of file