diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..35569f1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,33 @@ +# Git +.git/ +.gitignore + +# Rust build artifacts +target/ +Cargo.lock + +# IDE +.vscode/ +.idea/ +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db + +# Documentation +*.md +LICENSE + +# CI/CD +.github/ +.gitlab-ci.yml + +# Testing +tests/ +benches/ + +# Development files +*.log +*.tmp \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3a24b69..9e7be4d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,20 @@ # syntax=docker/dockerfile:1 -FROM ubuntu:22.04 +FROM alpine:3.19 -# Install runtime dependencies including GUI libraries -RUN apt-get update && apt-get install -y \ +# Install only essential runtime dependencies +RUN apk add --no-cache \ ca-certificates \ - libssl3 \ - libgtk-3-0 \ - libglib2.0-0 \ - libcairo2 \ - libpango-1.0-0 \ - libatk1.0-0 \ - libgdk-pixbuf2.0-0 \ - libxdo3 \ - && rm -rf /var/lib/apt/lists/* + libgcc \ + libstdc++ -# Copy the appropriate binary based on the target architecture +# Copy the CLI binary (without GUI dependencies) ARG TARGETARCH COPY bin/linux_${TARGETARCH}/khm /usr/local/bin/khm RUN chmod +x /usr/local/bin/khm -ENTRYPOINT ["/usr/local/bin/khm"] +# Create non-root user +RUN adduser -D -u 1000 khm +USER khm + +ENTRYPOINT ["/usr/local/bin/khm"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..aece9d8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,34 @@ +version: '3.8' + +services: + khm: + image: ultradesu/khm:latest + restart: unless-stopped + environment: + # Server mode configuration + - KHM_SERVER=true + - KHM_IP=0.0.0.0 + - KHM_PORT=8080 + - KHM_DB_HOST=postgres + - KHM_DB_NAME=khm + - KHM_DB_USER=khm + - KHM_DB_PASSWORD=changeme + - KHM_FLOWS=prod,staging,dev + ports: + - "8080:8080" + depends_on: + - postgres + command: ["--server", "--ip", "0.0.0.0", "--port", "8080", "--db-host", "postgres", "--db-name", "khm", "--db-user", "khm", "--db-password", "changeme", "--flows", "prod,staging,dev"] + + postgres: + image: postgres:16-alpine + restart: unless-stopped + environment: + - POSTGRES_USER=khm + - POSTGRES_PASSWORD=changeme + - POSTGRES_DB=khm + volumes: + - postgres_data:/var/lib/postgresql/data + +volumes: + postgres_data: \ No newline at end of file