feat: add Dockerfile and standalone output for Coolify deployment

- Dockerfile with multi-stage build (deps, build, runner)
- Standalone output for minimal Docker image
- .dockerignore to exclude unnecessary files
- Added react-is dependency for recharts
This commit is contained in:
Zebratic committed 2026-03-14 04:53:44 +00:00
1 parent e43c81250f
commit 348de00c3a
5 files changed
+47 -3

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
node_modules
.next
.env
.env.local
.git
+35
View File
@@ -0,0 +1,35 @@
FROM node:22-alpine AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci --legacy-peer-deps
FROM node:22-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Build-time env placeholders (real values injected at runtime)
ENV DATABASE_URL=mongodb://placeholder:27017/llm_proxy
ENV REDIS_URL=redis://placeholder:6379
ENV NEXTAUTH_SECRET=build-placeholder
ENV ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000
ENV NEXT_PUBLIC_APP_NAME="LLM Proxy"
ENV NEXT_PUBLIC_APP_URL=http://localhost:3000
RUN npm run build
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
CMD ["node", "server.js"]
+1
View File
@@ -1,6 +1,7 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: "standalone",
serverExternalPackages: ["pino", "pino-pretty"],
};
+5 -3
View File
@@ -32,6 +32,7 @@
"pino-pretty": "^13.0.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-is": "^19.2.4",
"react-markdown": "^10.1.0",
"recharts": "^3.7.0",
"rehype-highlight": "^7.0.2",
@@ -2969,6 +2970,7 @@
"version": "19.2.14",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz",
"integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==",
"dev": true,
"license": "MIT",
"dependencies": {
"csstype": "^3.2.2"
@@ -2978,7 +2980,7 @@
"version": "19.2.3",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz",
"integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==",
"devOptional": true,
"dev": true,
"license": "MIT",
"peerDependencies": {
"@types/react": "^19.2.0"
@@ -4185,6 +4187,7 @@
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
"dev": true,
"license": "MIT"
},
"node_modules/d3-array": {
@@ -8837,8 +8840,7 @@
"version": "19.2.4",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.4.tgz",
"integrity": "sha512-W+EWGn2v0ApPKgKKCy/7s7WHXkboGcsrXE+2joLyVxkbyVQfO3MUEaUQDHoSmb8TFFrSKYa9mw64WZHNHSDzYA==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/react-markdown": {
"version": "10.1.0",
+1
View File
@@ -39,6 +39,7 @@
"pino-pretty": "^13.0.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-is": "^19.2.4",
"react-markdown": "^10.1.0",
"recharts": "^3.7.0",
"rehype-highlight": "^7.0.2",