-
Notifications
You must be signed in to change notification settings - Fork 0
fix(docker): non-root web image and secret-proof dockerignore #74
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 |
|---|---|---|
|
|
@@ -101,14 +101,21 @@ WORKDIR /calcom | |
|
|
||
| RUN apt-get update && apt-get install -y --no-install-recommends netcat-openbsd wget && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| COPY --from=builder-two /calcom ./ | ||
| # Why --chown: the container runs as the non-root node user (USER below); owning | ||
| # the tree lets the runtime write its caches (Next ISR, prisma engines) without | ||
| # adding a duplicate copy-up layer that a separate chown -R would create. | ||
| COPY --from=builder-two --chown=node:node /calcom ./ | ||
| ARG NEXT_PUBLIC_WEBAPP_URL=https://cal.crove.com | ||
| ENV NEXT_PUBLIC_WEBAPP_URL=$NEXT_PUBLIC_WEBAPP_URL \ | ||
| BUILT_NEXT_PUBLIC_WEBAPP_URL=$NEXT_PUBLIC_WEBAPP_URL | ||
|
|
||
| ENV NODE_ENV=production | ||
| EXPOSE 3000 | ||
|
|
||
| # HI-12: run as the unprivileged node user (uid 1000) shipped with the base | ||
| # image instead of root; apt above already ran as root. | ||
| USER node | ||
|
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. Using a non-numeric user name like Since the |
||
|
|
||
| HEALTHCHECK --interval=30s --timeout=30s --retries=5 \ | ||
| CMD wget --spider http://localhost:3000 || exit 1 | ||
|
Comment on lines
119
to
120
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. By default, Adding the |
||
|
|
||
|
|
||
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.
While
COPY --chown=node:nodecorrectly sets the ownership of the copied files, the/calcomdirectory itself was created byWORKDIR /calcomwhile running asroot. This leaves the/calcomdirectory owned byroot:rootwith0755permissions, which prevents the non-rootnodeuser from creating any new files or directories directly under/calcomat runtime (e.g., lockfiles, temporary files, or local cache directories).To prevent potential
Permission deniederrors, change the ownership of the/calcomdirectory tonode:nodeduring the setup phase.