Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.
TypeScript agent-harnessagent-harness-engineeringai-engineeringai-observabilityamd-gpuclaude-codeclickhousecodexcoding-agentcoding-agentscursorgenaigpu-monitoringllm-observabilityllmopsnvidia-smiobservabilityopen-sourceopenaiopentelemetry
[Fix]: Reduce Doku Client image size (#135)
Aman Agarwale7db57267630
diff --git a/src/client/Dockerfile b/src/client/Dockerfileindex 9b4abcb0..5efa3b7f 100644--- a/src/client/Dockerfile+++ b/src/client/Dockerfile@@ -1,5 +1,8 @@-# Use an official Node runtime as a base image-FROM node:20 as builder+# Use an alpine as a base image+FROM alpine as builder++# Installing node and npm+RUN apk add --update nodejs npm# Set the working directory in the containerWORKDIR /app/client@@ -10,15 +13,18 @@ COPY . .# Install dependencies & Build the Next.js applicationRUN npm install && npm run build+# Use a smaller image for production-FROM node:20+FROM alpine++RUN apk add --update nodejs npm# Set the working directory in the containerWORKDIR /app/client# Copy only necessary files from the builder stageCOPY --from=builder /app/client/.next ./.next-COPY --from=builder /app/client/node_modules ./node_modules+# COPY --from=builder /app/client/node_modules ./node_modulesCOPY --from=builder /app/client/package.json ./package.jsonCOPY --from=builder /app/client/package-lock.json ./package-lock.jsonCOPY --from=builder /app/client/public ./public@@ -27,9 +33,11 @@ COPY --from=builder /app/client/prisma ./prisma# Execute entrypoint script to generate NextAuth.js secret and run commandsCOPY --from=builder /app/client/entrypoint.sh ./entrypoint.shRUN chmod +x ./entrypoint.sh+# Installing extra packages+RUN apk --no-cache add bash openssl# Expose the port that Next.js will run onEXPOSE 3000# Run Prisma migrations using npx-CMD ["./entrypoint.sh"]+CMD ["/app/client/entrypoint.sh"]diff --git a/src/client/entrypoint.sh b/src/client/entrypoint.shindex 65b0ea03..95b2ee8a 100755--- a/src/client/entrypoint.sh+++ b/src/client/entrypoint.sh@@ -17,11 +17,12 @@ echo "INIT_DB_PORT=${INIT_DB_PORT}" >> /etc/environmentecho "INIT_DB_DATABASE=${INIT_DB_DATABASE}" >> /etc/environment# Run Prisma migrations and generate prisma client-npx prisma migrate deploy-npx prisma generate+npm install -g prisma+prisma migrate deploy+prisma generate# Run the seed-npx prisma db seed+prisma db seed# Start the Next.js applicationexec node --max_old_space_size=512 $(which npm) startdiff --git a/src/client/package.json b/src/client/package.jsonindex a7642653..6af42347 100644--- a/src/client/package.json+++ b/src/client/package.json@@ -44,6 +44,6 @@"typescript": "^5.3.3"},"prisma": {- "seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"+ "seed": "node prisma/seed.js"}}diff --git a/src/client/prisma/seed.ts b/src/client/prisma/seed.jssimilarity index 91%rename from src/client/prisma/seed.tsrename to src/client/prisma/seed.jsindex f7b354bf..3e75ee7d 100644--- a/src/client/prisma/seed.ts+++ b/src/client/prisma/seed.js@@ -1,6 +1,7 @@-import { PrismaClient } from "@prisma/client";+const { PrismaClient } = require("@prisma/client");const prisma = new PrismaClient();async function main() {+ console.log("Inside seeding.....");// const defaultPassword = "dokulabsuser"; ⤵const hashedPassword ="$2a$10$XmL4Q45wWgPzMJXlM5L70eFyYvUGgIeRRm5f4.OOlcaIM/sQB6j/S";@@ -49,6 +50,7 @@ async function main() {},});}+ console.log("Seeding End.....");}main().then(async () => {@@ -57,5 +59,4 @@ main().catch(async (e) => {console.error(e);await prisma.$disconnect();- process.exit(1);});diff --git a/src/client/tsconfig.json b/src/client/tsconfig.jsonindex e7892053..06294b09 100644--- a/src/client/tsconfig.json+++ b/src/client/tsconfig.json@@ -27,6 +27,6 @@"@/constants/*": ["./src/constants/*"],}},- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "prisma/seed.js"],"exclude": ["node_modules"]}