forked from formbricks/formbricks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22eb043
commit 6e8fdef
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
FROM node:18-alpine AS installer | ||
RUN corepack enable && corepack prepare pnpm@latest --activate | ||
|
||
ARG DATABASE_URL | ||
ENV DATABASE_URL=$DATABASE_URL | ||
|
||
ARG NEXTAUTH_SECRET | ||
ENV NEXTAUTH_SECRET=$NEXTAUTH_SECRET | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
RUN pwd | ||
RUN ls -la | ||
RUN touch ./apps/web/.env | ||
|
||
|
||
RUN pnpm install | ||
|
||
# Build the project | ||
RUN pnpm post-install --filter=web... | ||
RUN pnpm turbo run build --filter=web... | ||
|
||
FROM node:18-alpine AS runner | ||
RUN corepack enable && corepack prepare pnpm@latest --activate | ||
|
||
# Don't run production as root | ||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
USER nextjs | ||
|
||
WORKDIR /home/nextjs | ||
|
||
COPY --from=installer /app/apps/web/next.config.mjs . | ||
COPY --from=installer /app/apps/web/package.json . | ||
|
||
# Automatically leverage output traces to reduce image size | ||
# https://nextjs.org/docs/advanced-features/output-file-tracing | ||
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalone ./ | ||
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static | ||
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public | ||
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/pre-setup-server.js ./apps/web/pre-setup-server.js | ||
COPY --from=installer --chown=nextjs:nodejs /app/packages/database/schema.prisma ./packages/database/schema.prisma | ||
COPY --from=installer --chown=nextjs:nodejs /app/packages/database/migrations ./packages/database/migrations | ||
|
||
EXPOSE 3000 | ||
|
||
ENV HOSTNAME "0.0.0.0" | ||
|
||
CMD if [ "$NEXTAUTH_SECRET" != "RANDOM_STRING" ]; then \ | ||
pnpm dlx prisma migrate deploy && \ | ||
node apps/web/pre-setup-server.js; \ | ||
node apps/web/server.js; \ | ||
else \ | ||
echo "ERROR: Please set a value for NEXTAUTH_SECRET in your docker compose variables!"; \ | ||
exit 1; \ | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters