mirror of https://github.com/kortix-ai/suna.git
Merge pull request #934 from smolpaw/main
This commit is contained in:
commit
9c8df229d6
|
@ -88,9 +88,6 @@ services:
|
|||
- "3000:3000"
|
||||
volumes:
|
||||
- ./frontend/.env.local:/app/.env.local:ro
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
command: ["npm", "run", "start"]
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
Dockerfile
|
||||
.dockerignore
|
||||
node_modules
|
||||
npm-debug.log
|
||||
README.md
|
||||
.next
|
||||
.git
|
||||
|
||||
.prettierrc
|
||||
.prettierignore
|
||||
*.env
|
||||
env.*
|
||||
README.md
|
|
@ -1,34 +1,65 @@
|
|||
FROM node:20-slim
|
||||
# syntax=docker.io/docker/dockerfile:1
|
||||
# ---- Base Stage ----
|
||||
FROM node:22-slim AS base
|
||||
|
||||
# Install dependencies only when needed
|
||||
FROM base AS deps
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files first for better layer caching
|
||||
COPY package*.json ./
|
||||
# Install dependencies based on the preferred package manager
|
||||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
|
||||
RUN \
|
||||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
||||
elif [ -f package-lock.json ]; then npm ci; \
|
||||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
|
||||
else echo "Lockfile not found." && exit 1; \
|
||||
fi
|
||||
|
||||
# Install build dependencies for node-gyp
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
python3 \
|
||||
make \
|
||||
g++ \
|
||||
build-essential \
|
||||
pkg-config \
|
||||
libcairo2-dev \
|
||||
libpango1.0-dev \
|
||||
libjpeg-dev \
|
||||
libgif-dev \
|
||||
librsvg2-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN npm install
|
||||
|
||||
# Copy the frontend code
|
||||
# ---- Builder Stage ----
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
ENV NEXT_PUBLIC_VERCEL_ENV production
|
||||
# Next.js collects completely anonymous telemetry data about general usage.
|
||||
# Learn more here: https://nextjs.org/telemetry
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
ENV NEXT_OUTPUT=standalone
|
||||
|
||||
RUN npm run build
|
||||
RUN \
|
||||
if [ -f yarn.lock ]; then yarn run build; \
|
||||
elif [ -f package-lock.json ]; then npm run build; \
|
||||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
|
||||
else echo "Lockfile not found." && exit 1; \
|
||||
fi
|
||||
|
||||
# ---- Runner Stage ----
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NEXT_PUBLIC_VERCEL_ENV=production
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs
|
||||
RUN adduser --system --uid 1001 nextjs
|
||||
|
||||
COPY --from=builder /app/public ./public
|
||||
|
||||
# Automatically leverage output traces to reduce image size
|
||||
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
# Default command is dev, but can be overridden in docker-compose
|
||||
CMD ["npm", "start"]
|
||||
ENV PORT=3000
|
||||
|
||||
# server.js is created by next build from the standalone output
|
||||
# https://nextjs.org/docs/pages/api-reference/config/next-config-js/output
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
CMD ["node", "server.js"]
|
|
@ -1,6 +1,7 @@
|
|||
import type { NextConfig } from 'next';
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
};
|
||||
const nextConfig = (): NextConfig => ({
|
||||
output: (process.env.NEXT_OUTPUT as 'standalone') || undefined,
|
||||
});
|
||||
|
||||
export default nextConfig;
|
||||
|
|
Loading…
Reference in New Issue