diff --git a/Dockerfile b/Dockerfile index 5f5960b..92f4502 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,9 @@ -FROM node:22-alpine AS base -RUN corepack enable pnpm +FROM node:22-slim AS base +RUN corepack enable FROM base AS deps WORKDIR /app -RUN apk add --no-cache python3 make g++ -COPY package.json pnpm-lock.yaml ./ +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ RUN pnpm install --frozen-lockfile FROM base AS build @@ -16,7 +15,5 @@ RUN pnpm build FROM base AS runtime WORKDIR /app COPY --from=build /app/.output ./.output - -ENV NODE_ENV=production EXPOSE 3000 -CMD ["node", "./.output/server/index.mjs"] +CMD ["node", ".output/server/index.mjs"] diff --git a/app/components/LinksTable.vue b/app/components/LinksTable.vue index b9c0497..4cff52f 100644 --- a/app/components/LinksTable.vue +++ b/app/components/LinksTable.vue @@ -3,7 +3,7 @@ import type { TableColumn } from "@nuxt/ui"; const UBadge = resolveComponent("UBadge"); -const props = defineProps<{ +defineProps<{ data: Link[]; status: "pending" | "idle" | "success" | "error"; }>(); diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..f877f86 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,22 @@ +services: + app: + container_name: pihka-al-dev + build: + context: . + target: build + command: pnpm dev + ports: + - "3000:3000" + environment: + - DATABASE_URL=/data/db.sqlite + - ADMIN_USERNAME=admin + - ADMIN_PASSWORD=admin + - REDIRECT_DOMAIN=localhost + - NUXT_SESSION_PASSWORD=dev-session-password-32-chars-min + volumes: + - .:/app + - /app/node_modules + - db:/data + +volumes: + db: diff --git a/nuxt.config.ts b/nuxt.config.ts index 5796d65..72f49d9 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -16,14 +16,11 @@ export default defineNuxtConfig({ css: ['~/assets/css/main.css'], - compatibilityDate: '2025-01-15', + nitro: { + externals: { + external: ['better-sqlite3'], + }, + }, - eslint: { - config: { - stylistic: { - commaDangle: 'never', - braceStyle: '1tbs' - } - } - } + compatibilityDate: '2025-01-15', }) diff --git a/pnpm-workspace.yml b/pnpm-workspace.yml new file mode 100644 index 0000000..a5dd8fb --- /dev/null +++ b/pnpm-workspace.yml @@ -0,0 +1,6 @@ +onlyBuiltDependencies: + - "@parcel/watcher" + - better-sqlite3 + - esbuild + - unrs-resolver + - vue-demi diff --git a/server/plugins/migrations.ts b/server/plugins/migrations.ts new file mode 100644 index 0000000..6073c4f --- /dev/null +++ b/server/plugins/migrations.ts @@ -0,0 +1,6 @@ +import { migrate } from 'drizzle-orm/better-sqlite3/migrator' +import { db } from '../db' + +export default defineNitroPlugin(() => { + migrate(db, { migrationsFolder: 'server/db/migrations' }) +})