Update Dockerfile for correct directory structure
Browse files- Dockerfile +5 -4
- docker/entrypoint.sh +22 -4
Dockerfile
CHANGED
@@ -21,15 +21,16 @@ COPY web/package.json web/yarn.lock ./
|
|
21 |
# Install build dependencies globally first
|
22 |
RUN npm install -g code-inspector-plugin autoprefixer postcss tailwindcss
|
23 |
|
24 |
-
# Install project dependencies
|
25 |
-
RUN yarn install --frozen-lockfile --network-timeout
|
26 |
yarn add --dev @types/node @types/react code-inspector-plugin autoprefixer postcss tailwindcss
|
27 |
|
28 |
# Copy source files
|
29 |
COPY web/ .
|
30 |
|
31 |
-
# Build the application with standalone output
|
32 |
-
|
|
|
33 |
|
34 |
# Python builder stage
|
35 |
FROM python:3.10-slim-bookworm AS python-builder
|
|
|
21 |
# Install build dependencies globally first
|
22 |
RUN npm install -g code-inspector-plugin autoprefixer postcss tailwindcss
|
23 |
|
24 |
+
# Install project dependencies with a timeout
|
25 |
+
RUN yarn install --frozen-lockfile --network-timeout 600000 && \
|
26 |
yarn add --dev @types/node @types/react code-inspector-plugin autoprefixer postcss tailwindcss
|
27 |
|
28 |
# Copy source files
|
29 |
COPY web/ .
|
30 |
|
31 |
+
# Build the application with standalone output and increased memory
|
32 |
+
ENV NODE_OPTIONS="--max_old_space_size=4096"
|
33 |
+
RUN yarn build || (echo "Build failed with exit code $?" && exit 1)
|
34 |
|
35 |
# Python builder stage
|
36 |
FROM python:3.10-slim-bookworm AS python-builder
|
docker/entrypoint.sh
CHANGED
@@ -16,11 +16,29 @@ gunicorn --bind 0.0.0.0:7860 \
|
|
16 |
# Start Next.js web server
|
17 |
cd /app/web
|
18 |
echo "Starting Next.js server on port 3000..."
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
cd .next/standalone
|
23 |
-
|
|
|
|
|
|
|
24 |
|
25 |
# Wait for both processes
|
26 |
wait
|
|
|
16 |
# Start Next.js web server
|
17 |
cd /app/web
|
18 |
echo "Starting Next.js server on port 3000..."
|
19 |
+
|
20 |
+
# Ensure standalone directory exists
|
21 |
+
if [ ! -d ".next/standalone" ]; then
|
22 |
+
echo "Error: Next.js standalone build not found"
|
23 |
+
exit 1
|
24 |
+
fi
|
25 |
+
|
26 |
+
# Copy static files if they exist
|
27 |
+
if [ -d ".next/static" ]; then
|
28 |
+
mkdir -p .next/standalone/.next
|
29 |
+
cp -r .next/static .next/standalone/.next/
|
30 |
+
fi
|
31 |
+
|
32 |
+
# Copy public files if they exist
|
33 |
+
if [ -d "public" ]; then
|
34 |
+
cp -r public .next/standalone/
|
35 |
+
fi
|
36 |
+
|
37 |
cd .next/standalone
|
38 |
+
echo "Starting Next.js standalone server..."
|
39 |
+
NODE_ENV=production \
|
40 |
+
NEXT_TELEMETRY_DISABLED=1 \
|
41 |
+
node server.js &
|
42 |
|
43 |
# Wait for both processes
|
44 |
wait
|