diff --git a/.gitea/workflows/backend.yaml b/.gitea/workflows/backend.yaml index 5771a2e..c807b00 100644 --- a/.gitea/workflows/backend.yaml +++ b/.gitea/workflows/backend.yaml @@ -5,12 +5,14 @@ on: pull_request: paths: - 'legalconsenthub-backend/**' + - 'api/**' - '.gitea/workflows/backend.yaml' push: branches: - main paths: - 'legalconsenthub-backend/**' + - 'api/**' - '.gitea/workflows/backend.yaml' jobs: @@ -95,7 +97,8 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v5 with: - context: ./legalconsenthub-backend + context: . + file: ./legalconsenthub-backend/Dockerfile push: ${{ gitea.event_name == 'push' && gitea.ref == 'refs/heads/main' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.gitea/workflows/frontend.yaml b/.gitea/workflows/frontend.yaml index 0c77eb0..670212f 100644 --- a/.gitea/workflows/frontend.yaml +++ b/.gitea/workflows/frontend.yaml @@ -5,12 +5,14 @@ on: pull_request: paths: - 'legalconsenthub/**' + - 'api/**' - '.gitea/workflows/frontend.yaml' push: branches: - main paths: - 'legalconsenthub/**' + - 'api/**' - '.gitea/workflows/frontend.yaml' jobs: @@ -89,7 +91,8 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v5 with: - context: ./legalconsenthub + context: . + file: ./legalconsenthub/Dockerfile push: ${{ gitea.event_name == 'push' && gitea.ref == 'refs/heads/main' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/legalconsenthub-backend/api/legalconsenthub.yml b/api/legalconsenthub.yml similarity index 100% rename from legalconsenthub-backend/api/legalconsenthub.yml rename to api/legalconsenthub.yml diff --git a/legalconsenthub-backend/Dockerfile b/legalconsenthub-backend/Dockerfile index 8ca12a6..2f89ab9 100644 --- a/legalconsenthub-backend/Dockerfile +++ b/legalconsenthub-backend/Dockerfile @@ -2,17 +2,20 @@ FROM eclipse-temurin:21-jdk-alpine AS builder WORKDIR /workspace/app -COPY gradlew . -COPY gradle gradle -COPY build.gradle . -COPY settings.gradle . -COPY api api +RUN mkdir -p ../api + +COPY api/legalconsenthub.yml ../api/ + +COPY legalconsenthub-backend/gradlew . +COPY legalconsenthub-backend/gradle gradle +COPY legalconsenthub-backend/build.gradle . +COPY legalconsenthub-backend/settings.gradle . RUN chmod +x ./gradlew RUN ./gradlew dependencies --no-daemon -COPY src src +COPY legalconsenthub-backend/src src RUN ./gradlew bootJar -x test --no-daemon diff --git a/legalconsenthub-backend/build.gradle b/legalconsenthub-backend/build.gradle index 2b19f35..8417be4 100644 --- a/legalconsenthub-backend/build.gradle +++ b/legalconsenthub-backend/build.gradle @@ -88,7 +88,7 @@ tasks.named('test') { task generate_legalconsenthub_server(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) { generatorName = 'kotlin-spring' - inputSpec = "$rootDir/api/legalconsenthub.yml".toString() + inputSpec = "$rootDir/../api/legalconsenthub.yml".toString() outputDir = generatedSourcesServerLegalconsenthubDir apiPackage = 'com.betriebsratkanzlei.legalconsenthub_api.api' modelPackage = 'com.betriebsratkanzlei.legalconsenthub_api.model' diff --git a/legalconsenthub/Dockerfile b/legalconsenthub/Dockerfile index d953983..aadc050 100644 --- a/legalconsenthub/Dockerfile +++ b/legalconsenthub/Dockerfile @@ -6,11 +6,15 @@ RUN apk add --no-cache openjdk21-jre RUN npm install -g pnpm@10.13.1 -COPY package.json pnpm-lock.yaml ./ +RUN mkdir -p ../api + +COPY api/legalconsenthub.yml ../api/ + +COPY legalconsenthub/package.json legalconsenthub/pnpm-lock.yaml ./ RUN pnpm install --frozen-lockfile -COPY . . +COPY legalconsenthub/ . RUN pnpm build diff --git a/legalconsenthub/package.json b/legalconsenthub/package.json index e6d1624..184f465 100644 --- a/legalconsenthub/package.json +++ b/legalconsenthub/package.json @@ -12,8 +12,8 @@ "type-check": "nuxi typecheck", "lint": "eslint .", "lint:fix": "eslint . --fix", - "api:generate": "openapi-generator-cli generate -i ../legalconsenthub-backend/api/legalconsenthub.yml -g typescript-fetch -o .api-client", - "api:middleware:generate": "openapi-generator-cli generate -i ../legalconsenthub-middleware/api/legalconsenthub-middleware.yml -g typescript-fetch -o .api-client-middleware" + "api:generate": "openapi-generator-cli generate -i ../api/legalconsenthub.yml -g typescript-fetch -o .api-client", + "api:middleware:generate": "openapi-generator-cli generate -i ../api/legalconsenthub-middleware.yml -g typescript-fetch -o .api-client-middleware" }, "dependencies": { "@nuxt/ui": "^4.1.0",