refactor: simplify Docker build setup

- Remove all simple Docker files (Dockerfile.simple, Dockerfile.simple-local, build-simple-docker.sh)
- Remove docker-compose.local.yml
- Update docker-compose.yml to use Dockerfile.local for builds
- Update build-local-docker.sh as the single build script
- Keep only multi-stage Dockerfile.local for comprehensive local builds
This commit is contained in:
duong.doan1 2026-04-07 18:29:00 +07:00
parent 2938c9471e
commit 7750b593f6
7 changed files with 20 additions and 71 deletions

View file

@ -1,14 +0,0 @@
FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
# Copy the built JAR file (assuming it's built locally)
COPY komga/build/libs/komga-*.jar komga.jar
# Create non-root user
RUN addgroup -S komga && adduser -S komga -G komga
USER komga
EXPOSE 25600
ENTRYPOINT ["java", "-jar", "komga.jar"]

View file

@ -1,14 +0,0 @@
FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
# Copy the built JAR file (assume it's built locally first)
COPY komga/build/libs/komga-*.jar komga.jar
# Create non-root user
RUN addgroup -S komga && adduser -S komga -G komga
USER komga
EXPOSE 25600
ENTRYPOINT ["java", "-jar", "komga.jar"]

View file

@ -1,6 +1,6 @@
#!/bin/bash
# Build local Docker image for Komga
# Build Komga Docker image locally with multi-stage build
set -e
echo "Building Komga Docker image locally..."
@ -9,17 +9,20 @@ echo "Building Komga Docker image locally..."
VERSION=$(grep 'version=' gradle.properties | cut -d'=' -f2)
echo "Building version: $VERSION"
# Build Docker image with Node.js 18 support
# Build Docker image with multi-stage build (Node.js 18 + Java 21)
docker build -f Dockerfile.local -t komga-local:$VERSION .
echo ""
echo "Docker image built successfully:"
echo " Image: komga-local:$VERSION"
echo " Node.js: 18.20.4 (from Alpine 3.18 repository)"
echo " Java: 21 (Temurin)"
echo " Build: Multi-stage (Node.js 18 + Java 21)"
echo " Runtime: Java 21 (Temurin JRE)"
echo ""
echo "To run the container:"
echo "To run standalone container:"
echo " docker run -p 25600:25600 -v /path/to/config:/config komga-local:$VERSION"
echo ""
echo "To run with docker-compose:"
echo " docker-compose up -d"
echo ""
echo "To tag with different name:"
echo " docker tag komga-local:$VERSION komga:latest"

View file

@ -1,31 +0,0 @@
#!/bin/bash
# Build Komga locally and create Docker image
set -e
echo "Building Komga Docker image from existing JAR..."
# Get version from gradle.properties
VERSION=$(grep 'version=' gradle.properties | cut -d'=' -f2)
echo "Building Docker image for version: $VERSION"
# Check if JAR exists
if [ ! -f "komga/build/libs/komga-$VERSION.jar" ]; then
echo "Error: JAR file not found. Run './gradlew bootJar' first."
exit 1
fi
# Build Docker image
docker build -f Dockerfile.simple-local -t komga-local:$VERSION .
echo ""
echo "Docker image built successfully:"
echo " Image: komga-local:$VERSION"
echo " Size: $(docker images --format "{{.Size}}" komga-local:$VERSION)"
echo " Java: 21 (Temurin JRE)"
echo " Entrypoint: java -jar komga.jar"
echo ""
echo "To run the container:"
echo " docker run -p 25600:25600 -v /path/to/config:/config komga-local:$VERSION"
echo ""
echo "Note: Assumes frontend was already built (via prepareThymeLeaf)"

View file

@ -2,7 +2,7 @@ version: '3.8'
services:
postgres-test:
image: postgres:16-alpine
image: postgres:15-alpine
container_name: komga-postgres-test
environment:
POSTGRES_DB: komga_test
@ -21,9 +21,7 @@ services:
command: ["postgres", "-c", "log_statement=all"] # Log all SQL for debugging
komga-test:
build:
context: .
dockerfile: docker/Dockerfile
image: gotson/komga:latest
container_name: komga-test-backend
depends_on:
postgres-test:
@ -39,7 +37,6 @@ services:
- "25601:25600"
volumes:
- ./data:/data:ro
command: ["./gradlew", ":komga:bootRun", "--args='--spring.profiles.active=test'"]
restart: "no"
volumes:

View file

@ -22,7 +22,7 @@ services:
komga:
build:
context: .
dockerfile: Dockerfile.simple-local
dockerfile: Dockerfile.local
container_name: komga-backend
depends_on:
postgres:

View file

@ -4,4 +4,12 @@
-- Enable required extensions
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS "pg_trgm"; -- For text search/pattern matching
CREATE EXTENSION IF NOT EXISTS "unaccent"; -- For accent removal (similar to UDF_STRIP_ACCENTS)
CREATE EXTENSION IF NOT EXISTS "unaccent"; -- For accent removal (similar to UDF_STRIP_ACCENTS)
-- Set reasonable default configuration for Komga
ALTER DATABASE komga SET timezone TO 'UTC';
ALTER DATABASE komga SET default_transaction_isolation TO 'read committed';
ALTER DATABASE komga SET lock_timeout TO '30s';
ALTER DATABASE komga SET statement_timeout TO '60000';
-- Create schema if needed (public schema is default)