-
Notifications
You must be signed in to change notification settings - Fork 193
feat: make the studio image rootless #2211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -47,19 +47,22 @@ RUN pnpm run --filter=./connect --filter=./shared --filter=./studio --filter=./c | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| FROM --platform=${BUILDPLATFORM} node:lts-alpine | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| RUN apk add --no-cache --upgrade bash | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| USER node | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| WORKDIR /app | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ENV NODE_ENV=production | ||||||||||||||||||||||||
| ENV NEXT_TELEMETRY_DISABLED=1 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Fetch built artifacts | ||||||||||||||||||||||||
| COPY --from=builder /app/studio/.next/standalone ./ | ||||||||||||||||||||||||
| COPY --from=builder /app/studio/public/ ./studio/public | ||||||||||||||||||||||||
| COPY --from=builder /app/studio/.next/static ./studio/.next/static | ||||||||||||||||||||||||
| COPY --from=builder /app/studio/entrypoint.sh . | ||||||||||||||||||||||||
| COPY --from=builder /app/studio/.env.production . | ||||||||||||||||||||||||
| COPY --from=builder --chown=node:node /app/studio/.next/standalone ./ | ||||||||||||||||||||||||
| COPY --from=builder --chown=node:node /app/studio/public/ ./studio/public | ||||||||||||||||||||||||
| COPY --from=builder --chown=node:node /app/studio/.next/static ./studio/.next/static | ||||||||||||||||||||||||
| COPY --from=builder --chown=node:node /app/studio/entrypoint.sh . | ||||||||||||||||||||||||
| COPY --from=builder --chown=node:node /app/studio/.env.production . | ||||||||||||||||||||||||
|
Comment on lines
+60
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainEnsure .next root (and BUILD_ID) are present and writable for non-root sed operations. The original failure referenced sed temp files in COPY --from=builder --chown=node:node /app/studio/.next/standalone ./
COPY --from=builder --chown=node:node /app/studio/public/ ./studio/public
COPY --from=builder --chown=node:node /app/studio/.next/static ./studio/.next/static
+COPY --from=builder --chown=node:node /app/studio/.next/BUILD_ID ./studio/.next/BUILD_ID
COPY --from=builder --chown=node:node /app/studio/entrypoint.sh .
COPY --from=builder --chown=node:node /app/studio/.env.production .Quick check: 🏁 Script executed: #!/bin/bash
# Does entrypoint mutate BUILD_ID or anything under .next?
rg -n 'sed.*\.next/BUILD_ID|\.next/.* -i' studio/entrypoint.shLength of output: 0 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "PWD: $(pwd)"
echo "---- studio dir listing ----"
ls -la studio || true
echo
echo "---- studio/Dockerfile (first 240 lines) ----"
if [ -f studio/Dockerfile ]; then
sed -n '1,240p' studio/Dockerfile
else
echo "NO studio/Dockerfile"
fi
echo
echo "---- studio/entrypoint.sh (first 240 lines) ----"
if [ -f studio/entrypoint.sh ]; then
sed -n '1,240p' studio/entrypoint.sh
else
echo "NO studio/entrypoint.sh"
fi
echo
echo "---- Search repo for BUILD_ID references ----"
rg -n --hidden -S 'BUILD_ID|\\.next/BUILD_ID' || true
echo
echo "---- Search repo for sed editing files under .next or using -i ----"
rg -n --hidden -S 'sed.*\\.next|sed\\s+-i' || true
echo
echo "---- Search Dockerfiles for copying .next artifacts ----"
rg -n --hidden -S 'COPY .*\\.next' || trueLength of output: 5091 Copy .next/BUILD_ID into the image and ensure .next is writable entrypoint.sh runs sed -i across ./studio/.next files; Dockerfile copies .next/static but not .next/BUILD_ID — add BUILD_ID so sed/temp-file creation won't fail at runtime. COPY --from=builder --chown=node:node /app/studio/.next/standalone ./
COPY --from=builder --chown=node:node /app/studio/public/ ./studio/public
COPY --from=builder --chown=node:node /app/studio/.next/static ./studio/.next/static
+COPY --from=builder --chown=node:node /app/studio/.next/BUILD_ID ./studio/.next/BUILD_ID
COPY --from=builder --chown=node:node /app/studio/entrypoint.sh .
COPY --from=builder --chown=node:node /app/studio/.env.production .📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| RUN apk add --no-cache --upgrade bash | ||||||||||||||||||||||||
| RUN ["chmod", "+x", "./entrypoint.sh"] | ||||||||||||||||||||||||
| ENTRYPOINT ["./entrypoint.sh"] | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix platform selection for the final image stage.
Using BUILDPLATFORM for the final stage will produce images for the builder arch in multi-arch builds. Use TARGETPLATFORM or drop the override.
📝 Committable suggestion
🤖 Prompt for AI Agents