Skip to content

Commit 9fbc262

Browse files
authored
Fix sharp missing error in logs (SSWConsulting#2570)
pnpm - update to use version specified in package.json Specifies version of pnpm in package.json to avoid version mismatches between dev laptops/CI runners
1 parent 3a21b83 commit 9fbc262

8 files changed

+32
-873805
lines changed

.dockerignore

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ _docs
33
.devcontainer
44
.git
55
.github
6-
# .next
76
.vscode
87
.vs
98
Dockerfile

.github/workflows/main-build-and-deploy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- uses: actions/checkout@v4
2828
- uses: pnpm/action-setup@v3
2929
with:
30-
version: 8
30+
package_json_file: package.json
3131
- name: Install dependencies
3232
run: pnpm install
3333

.github/workflows/pr-lint-code.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
- uses: pnpm/action-setup@v3
3535
with:
36-
version: 8
36+
package_json_file: package.json
3737

3838
- name: Setup node
3939
uses: actions/setup-node@v4

.github/workflows/pr-push-deploy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- uses: actions/checkout@v4
2626
- uses: pnpm/action-setup@v3
2727
with:
28-
version: 8
28+
package_json_file: package.json
2929
- name: Install dependencies
3030
run: pnpm install
3131

.github/workflows/template-ui-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434

3535
- uses: pnpm/action-setup@v3
3636
with:
37-
version: 8
37+
package_json_file: package.json
3838

3939
- name: Setup Node
4040
uses: actions/setup-node@v4

Dockerfile

+25-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
FROM node:lts-alpine AS base
2+
13
# Install dependencies only when needed
2-
FROM node:lts-alpine AS deps
3-
RUN corepack enable
4+
FROM base AS deps
45

56
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
67
RUN apk add --no-cache libc6-compat
@@ -16,12 +17,11 @@ RUN \
1617
fi
1718

1819
# Rebuild the source code only when needed
19-
FROM node:lts-alpine AS builder
20-
RUN corepack enable
20+
FROM base AS builder
2121
WORKDIR /app
2222

23-
COPY . .
2423
COPY --from=deps /app/node_modules ./node_modules
24+
COPY . .
2525

2626
# Add env for production
2727
# COPY .docker/production/.env.local .env.local
@@ -89,32 +89,42 @@ ENV TINA_SEARCH_TOKEN $TINA_SEARCH_TOKEN
8989
ARG NEXT_PUBLIC_SLOT_URL
9090
ENV NEXT_PUBLIC_SLOT_URL $NEXT_PUBLIC_SLOT_URL
9191

92-
RUN pnpm run build
92+
RUN \
93+
if [ -f yarn.lock ]; then yarn run build; \
94+
elif [ -f package-lock.json ]; then npm run build; \
95+
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
96+
else echo "Lockfile not found." && exit 1; \
97+
fi
9398

9499
# Production image, copy all the files and run next
95-
FROM node:lts-alpine AS runner
96-
RUN corepack enable
100+
FROM base AS runner
97101
WORKDIR /app
98102

103+
ENV NODE_ENV production
99104
# Uncomment the following line in case you want to disable telemetry during runtime.
100105
# ENV NEXT_TELEMETRY_DISABLED 1
101106

102107
RUN addgroup --system --gid 1001 nodejs
103108
RUN adduser --system --uid 1001 nextjs
104109

110+
COPY --from=builder /app/public ./public
111+
112+
# Set the correct permission for prerender cache
113+
RUN mkdir .next
114+
RUN chown nextjs:nodejs .next
115+
105116
# Automatically leverage output traces to reduce image size
106117
# https://nextjs.org/docs/advanced-features/output-file-tracing
118+
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
119+
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
120+
COPY --from=builder --chown=nextjs:nodejs /app/appInsight-api.js ./
107121

108122
USER nextjs
109123

110124
EXPOSE 3000
111125

112-
ENV NODE_ENV production
113126
ENV PORT 3000
114127

115-
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
116-
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
117-
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
118-
COPY --from=builder --chown=nextjs:nodejs /app/appInsight-api.js ./
119-
120-
CMD ["node", "--require", "./appInsight-api.js", "server.js"]
128+
# server.js is created by next build from the standalone output
129+
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
130+
CMD HOSTNAME="0.0.0.0" node --require ./appInsight-api.js server.js

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,6 @@
9898
},
9999
"resolutions": {
100100
"final-form": "4.20.1"
101-
}
101+
},
102+
"packageManager": "[email protected]"
102103
}

0 commit comments

Comments
 (0)