File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- FROM node:20.19.0 AS base
1+ FROM node:20.19.0-alpine AS deps
2+
23WORKDIR /app
34
4- FROM base AS deps
5- COPY package.json yarn.lock ./
6- RUN yarn install --frozen-lockfile
5+ # Install dependencies (use lockfile if present for reproducible builds)
6+ COPY package.json yarn.lock* ./
7+ RUN if [ -f yarn.lock ]; then yarn install --frozen-lockfile; else yarn install; fi
78
8- FROM base AS builder
9- COPY --from=deps /app/node_modules ./node_modules
10- COPY . .
11- RUN yarn run build
9+ FROM node:20.19.0-alpine AS builder
1210
13- FROM base AS runner
11+ WORKDIR /app
1412ENV NODE_ENV=production
13+
14+ COPY . .
15+ COPY --from=deps /app/node_modules ./node_modules
16+
17+ RUN yarn run build:staging
18+
19+ FROM node:20.19.0-alpine AS runner
20+
1521WORKDIR /app
16- COPY --from=builder /app/package.json ./package.json
17- COPY --from=builder /app/next.config.js ./next.config.js
22+ ENV NODE_ENV=production
23+ ENV NEXT_TELEMETRY_DISABLED=1
24+ ENV PORT=3005
25+
26+ # Copy only the minimal standalone output
1827COPY --from=builder /app/public ./public
19- COPY --from=builder /app/.next ./.next
20- COPY --from=builder /app/node_modules ./node_modules
28+ COPY --from=builder /app/.next/standalone ./
29+ COPY --from=builder /app/.next/static ./.next/static
30+ COPY --from=builder /app/.env ./.env
31+
2132EXPOSE 3005
22- CMD ["yarn" , "run" , "start:staging" ]
33+
34+ CMD ["node" , "server.js" ]
35+
Original file line number Diff line number Diff line change 11services :
2- web :
3- build : .
2+ app :
3+ build :
4+ context : .
5+ dockerfile : Dockerfile
46 ports :
57 - " 3005:3005"
8+ environment :
9+ - NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
10+ - NEXTAUTH_URL=${NEXTAUTH_URL}
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ module.exports = async () => {
2020 defaultLocale : 'en' ,
2121 } ,
2222 assetPrefix : isLocal ? '' : '/uxcore_next' ,
23+ output : 'standalone' ,
2324 async rewrites ( ) {
2425 return [
2526 {
@@ -47,9 +48,6 @@ module.exports = async () => {
4748 experimental : {
4849 manualClientBasePath : true ,
4950 } ,
50- env : {
51- NEXTAUTH_URL : process . env . NEXTAUTH_URL ,
52- } ,
5351 compiler : {
5452 removeConsole :
5553 process . env . NODE_ENV === 'prod' ? { exclude : [ 'error' ] } : false ,
You can’t perform that action at this time.
0 commit comments