Skip to content

Commit 02f05da

Browse files
authored
Merge pull request #38 from keepsimpleio/chore/docker-configs
chore: change Docker and Next configs
2 parents 3bba701 + ae957e1 commit 02f05da

2 files changed

Lines changed: 26 additions & 14 deletions

File tree

Dockerfile

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
1-
FROM node:20.19.0 AS base
1+
FROM node:20.19.0-alpine AS deps
2+
23
WORKDIR /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
1412
ENV 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+
1521
WORKDIR /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
1827
COPY --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+
2131
EXPOSE 3005
22-
CMD ["yarn", "run", "start:staging"]
32+
33+
CMD ["node", "server.js"]

next.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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
{

0 commit comments

Comments
 (0)