diff --git a/Dockerfile b/Dockerfile index 75d050f..659a03b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,14 +5,22 @@ WORKDIR /app # Enable CGO for sqlite3 ENV CGO_ENABLED=1 -# Install sqlc for code generation -RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@v1.30.0 +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + unzip \ + gcc \ + libc6-dev \ + libsqlite3-dev \ + && rm -rf /var/lib/apt/lists/* -# Install build dependencies for bun + assets -RUN apt-get update && apt-get install -y ca-certificates sqlite3 curl unzip && rm -rf /var/lib/apt/lists/* +# Install bun (for building frontend assets) RUN curl -fsSL https://bun.sh/install | bash ENV PATH="/root/.bun/bin:${PATH}" +# Install sqlc for code generation +RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@v1.30.0 + ENV GOPROXY=direct COPY go.mod go.sum ./ RUN go mod download @@ -50,7 +58,7 @@ COPY --from=builder /app/templates ./templates COPY --from=builder /app/static ./static COPY --from=builder /app/dist ./dist COPY --from=builder /app/internal/database/migrations ./migrations -COPY docker/entrypoint.sh ./entrypoint.sh +COPY entrypoint.sh ./entrypoint.sh EXPOSE 3000 diff --git a/bun.lock b/bun.lock index 1585244..a1ed8a7 100644 --- a/bun.lock +++ b/bun.lock @@ -4,9 +4,6 @@ "workspaces": { "": { "name": "myanimelist-ui", - "dependencies": { - "dompurify": "^3.4.1", - }, "devDependencies": { "@tailwindcss/cli": "^4.2.4", "@types/node": "^24.0.0", @@ -126,8 +123,6 @@ "@types/node": ["@types/node@24.12.4", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GUUEShf+PBCGW2KaXwcIt3Yk+e3pkKwWKb9GSyM9WQVE+ep2jzmHdGsHzu4wgcZy5fN9FBdVzjpBQsYlpfpgLA=="], - "@types/trusted-types": ["@types/trusted-types@2.0.7", "", {}, "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw=="], - "@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.59.2", "", { "dependencies": { "@eslint-community/regexpp": "^4.12.2", "@typescript-eslint/scope-manager": "8.59.2", "@typescript-eslint/type-utils": "8.59.2", "@typescript-eslint/utils": "8.59.2", "@typescript-eslint/visitor-keys": "8.59.2", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.5.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.59.2", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "sha512-j/bwmkBvHUtPNxzuWe5z6BEk3q54YRyGlBXkSsmfoih7zNrBvl5A9A98anlp/7JbyZcWIJ8KXo/3Tq/DjFLtuQ=="], "@typescript-eslint/parser": ["@typescript-eslint/parser@8.59.2", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.59.2", "@typescript-eslint/types": "8.59.2", "@typescript-eslint/typescript-estree": "8.59.2", "@typescript-eslint/visitor-keys": "8.59.2", "debug": "^4.4.3" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "sha512-plR3pp6D+SSUn1HM7xvSkx12/DhoHInI2YF35KAcVFNZvlC0gtrWqx7Qq1oH2Ssgi0vlFRCTbP+DZc7B9+TtsQ=="], @@ -166,8 +161,6 @@ "detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="], - "dompurify": ["dompurify@3.4.1", "", { "optionalDependencies": { "@types/trusted-types": "^2.0.7" } }, "sha512-JahakDAIg1gyOm7dlgWSDjV4n7Ip2PKR55NIT6jrMfIgLFgWo81vdr1/QGqWtFNRqXP9UV71oVePtjqS2ebnPw=="], - "enhanced-resolve": ["enhanced-resolve@5.20.1", "", { "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.3.0" } }, "sha512-Qohcme7V1inbAfvjItgw0EaxVX5q2rdVEZHRBrEQdRZTssLDGsL8Lwrznl8oQ/6kuTJONLaDcGjkNP247XEhcA=="], "escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="], diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..f9ed1dc --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +: "${DATABASE_FILE:=/app/data/mal.db}" + +if [ ! -x /app/main_server ]; then + echo "ERROR: /app/main_server not found or not executable" >&2 + exit 1 +fi + +exec /app/main_server + diff --git a/package.json b/package.json index c2df9cc..abcfb5a 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "myanimelist-ui", + "name": "mal", "private": true, "type": "module", "scripts": { @@ -12,7 +12,7 @@ "lint": "bun run lint:ts && bun run lint:go", "lint:ts": "bunx eslint . --max-warnings 0", "lint:ts:fix": "bunx eslint . --fix", - "lint:go": "mkdir -p .cache/golangci-lint .cache/go-build && GOCACHE=$(pwd)/.cache/go-build GOLANGCI_LINT_CACHE=$(pwd)/.cache/golangci-lint golangci-lint run ./cmd/... && GOCACHE=$(pwd)/.cache/go-build GOLANGCI_LINT_CACHE=$(pwd)/.cache/golangci-lint golangci-lint run ./internal/... && GOCACHE=$(pwd)/.cache/go-build GOLANGCI_LINT_CACHE=$(pwd)/.cache/golangci-lint golangci-lint run ./pkg/... && GOCACHE=$(pwd)/.cache/go-build GOLANGCI_LINT_CACHE=$(pwd)/.cache/golangci-lint golangci-lint run ./integrations/..." + "lint:go": "golangci-lint run ./..." }, "devDependencies": { "@tailwindcss/cli": "^4.2.4", @@ -28,7 +28,5 @@ "tailwindcss": "^4.2.4", "typescript": "^6.0.3" }, - "dependencies": { - "dompurify": "^3.4.1" - } + "dependencies": {} }