From fa2b0e47e5637f99a097da15a090baf4487fc712 Mon Sep 17 00:00:00 2001 From: tiny Flutter team Date: Tue, 7 Apr 2026 22:34:27 +0700 Subject: [PATCH] chore: align Dockerfile.local with release workflow and fix postgresql migrations --- Dockerfile.local | 32 +++++++++---------- docker-compose.local.yml | 11 +++---- .../V20200706141854__initial_migration.sql | 30 +++++++++++++++++ 3 files changed, 50 insertions(+), 23 deletions(-) diff --git a/Dockerfile.local b/Dockerfile.local index c3c2567b..1abbebb9 100644 --- a/Dockerfile.local +++ b/Dockerfile.local @@ -1,17 +1,14 @@ -FROM node:18-alpine AS node-builder +FROM eclipse-temurin:21-jdk AS build WORKDIR /app -# Copy frontend source -COPY komga-webui/package.json komga-webui/package-lock.json ./ -RUN npm ci +# Install Node.js 18 (matching .nvmrc) +RUN apt-get update && \ + apt-get install -y curl && \ + curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ + apt-get install -y nodejs && \ + apt-get clean && rm -rf /var/lib/apt/lists/* -COPY komga-webui/ ./ -RUN npm run build - -FROM eclipse-temurin:21-jdk-alpine AS build - -WORKDIR /app # Copy gradle files COPY gradle ./gradle @@ -20,14 +17,15 @@ COPY gradle.properties ./ COPY settings.gradle ./ COPY build.gradle.kts ./ -# Copy source code +# Copy all subproject sources (komga, komga-tray, komga-webui) COPY komga ./komga +COPY komga-tray ./komga-tray +COPY komga-webui ./komga-webui -# Copy built frontend from node-builder -COPY --from=node-builder /app/dist komga-webui/dist - -# Build the application including frontend -RUN ./gradlew prepareThymeLeaf bootJar -x test +# Build the application - same as release.yml step +# Gradle's prepareThymeLeaf handles: npmInstall -> npmBuild -> copyWebDist -> prepareThymeLeaf +ENV NODE_OPTIONS="--max-old-space-size=4096" +RUN ./gradlew :komga:prepareThymeLeaf :komga:bootJar -x test -x generateGitProperties # Runtime stage FROM eclipse-temurin:21-jre-alpine @@ -43,4 +41,4 @@ USER komga EXPOSE 25600 -ENTRYPOINT ["java", "-jar", "komga.jar"] \ No newline at end of file +ENTRYPOINT ["java", "-Dspring.profiles.include=docker", "--enable-native-access=ALL-UNNAMED", "-jar", "komga.jar"] \ No newline at end of file diff --git a/docker-compose.local.yml b/docker-compose.local.yml index 6e354bd0..8011ee0a 100644 --- a/docker-compose.local.yml +++ b/docker-compose.local.yml @@ -14,7 +14,7 @@ services: - postgres_data:/var/lib/postgresql/data - ./docker/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql healthcheck: - test: ["CMD-SHELL", "pg_isready -U komga"] + test: [ "CMD-SHELL", "pg_isready -U komga" ] interval: 10s timeout: 5s retries: 5 @@ -34,10 +34,9 @@ services: KOMGA_DATABASE_USERNAME: komga KOMGA_DATABASE_PASSWORD: komga123 KOMGA_CONFIG_DIR: /config - SPRING_DATASOURCE_HIKARI_MAXIMUM_POOL_SIZE: 5 - SPRING_DATASOURCE_HIKARI_CONNECTION_TIMEOUT: 60000 - SPRING_DATASOURCE_HIKARI_VALIDATION_TIMEOUT: 5000 - SPRING_FLYWAY_ENABLED: "false" + KOMGA_DATABASE_POOL_SIZE: 10 + KOMGA_DATABASE_MAX_POOL_SIZE: 10 + SPRING_FLYWAY_ENABLED: "true" ports: - "25600:25600" volumes: @@ -47,4 +46,4 @@ services: volumes: postgres_data: - komga_config: \ No newline at end of file + komga_config: diff --git a/komga/src/flyway/resources/db/migration/postgresql/V20200706141854__initial_migration.sql b/komga/src/flyway/resources/db/migration/postgresql/V20200706141854__initial_migration.sql index a998e301..b1150687 100644 --- a/komga/src/flyway/resources/db/migration/postgresql/V20200706141854__initial_migration.sql +++ b/komga/src/flyway/resources/db/migration/postgresql/V20200706141854__initial_migration.sql @@ -84,6 +84,36 @@ CREATE TABLE BOOK FOREIGN KEY (SERIES_ID) REFERENCES SERIES (ID) ); +CREATE TABLE MEDIA +( + MEDIA_TYPE varchar NULL, + STATUS varchar NOT NULL, + THUMBNAIL bytea NULL, + CREATED_DATE timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + LAST_MODIFIED_DATE timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + COMMENT varchar NULL, + BOOK_ID varchar NOT NULL PRIMARY KEY, + PAGE_COUNT integer NOT NULL DEFAULT 0, + FOREIGN KEY (BOOK_ID) REFERENCES BOOK (ID) +); + +CREATE TABLE MEDIA_PAGE +( + FILE_NAME varchar NOT NULL, + MEDIA_TYPE varchar NOT NULL, + NUMBER integer NOT NULL, + BOOK_ID varchar NOT NULL, + PRIMARY KEY (BOOK_ID, NUMBER), + FOREIGN KEY (BOOK_ID) REFERENCES BOOK (ID) +); + +CREATE TABLE MEDIA_FILE +( + FILE_NAME varchar NOT NULL, + BOOK_ID varchar NOT NULL, + FOREIGN KEY (BOOK_ID) REFERENCES BOOK (ID) +); + CREATE TABLE BOOK_METADATA ( CREATED_DATE timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,