diff --git a/DockerFile b/DockerFile index 920a362..f5dc9b6 100644 --- a/DockerFile +++ b/DockerFile @@ -1,5 +1,6 @@ # Stage 1: Build -FROM node:18-alpine AS builder +# Change from node:18-alpine to node:22-alpine +FROM node:22-alpine AS builder WORKDIR /app @@ -7,7 +8,7 @@ WORKDIR /app ARG NEXT_PUBLIC_API_URL ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} -# Copy package file +# Copy package files COPY package.json package-lock.json ./ # Install ALL dependencies (including dev dependencies for build) @@ -20,7 +21,8 @@ COPY . . RUN npm run build # Stage 2: Run -FROM node:18-alpine AS runner +# Change from node:18-alpine to node:22-alpine +FROM node:22-alpine AS runner WORKDIR /app @@ -31,12 +33,12 @@ ENV NODE_ENV=production ARG NEXT_PUBLIC_API_URL ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} -# Copy necessary files +# Copy necessary files from the standalone build COPY --from=builder /app/public ./public COPY --from=builder /app/.next/standalone ./ COPY --from=builder /app/.next/static ./.next/static -# Create cache directory with wide-open permissions +# Create cache directory with proper permissions RUN mkdir -p .next/cache/images && \ chmod -R 777 .next/cache @@ -46,5 +48,8 @@ EXPOSE 3000 ENV PORT=3000 ENV HOSTNAME="0.0.0.0" -# Start the app (running as root to avoid permission issues) +# Set node options to fix the IPv6 issue we discussed earlier +ENV NODE_OPTIONS="--dns-result-order=ipv4first" + +# Start the app CMD ["node", "server.js"] \ No newline at end of file