Skip to content

Commit

Permalink
prerender for postgresql too
Browse files Browse the repository at this point in the history
  • Loading branch information
rubys committed Dec 26, 2024
1 parent eebcf1e commit 367ab4f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions gdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ export class GDF {

if (!((this.prisma && this.sqlite3) ||
(this.options.swap && !this.flySetup()) ||
this.nextjsGeneration ||
this.adonisjs)) return null

const entrypoint = [`/app/${this.configDir}docker-entrypoint.js`]
Expand Down
8 changes: 7 additions & 1 deletion templates/docker-entrypoint.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ if (process.env.DATABASE_URL) {
<%= tab(1) %>writeFileSync('/proc/sys/vm/overcommit_memory', '1')

<% } -%>
<% if (prisma || (build && options.deferBuild)) { -%>
<% if (prisma || (build && options.deferBuild) || nextjsGeneration) { -%>
<% if (prisma && sqlite3) { -%>
<%= tab(1) %>// If running the web server then migrate existing database
<% } else { -%>
<%= tab(1) %>// If running the web server then prerender pages
<% } -%>
<%= tab(1) %>if (process.argv.slice(2).join(' ') === '<%-
Array.isArray(startCommand) ? startCommand.join(" ") : startCommand
%>'<% if (litefs) { %> && process.env.FLY_REGION === process.env.PRIMARY_REGION<% } %>) {
Expand All @@ -81,7 +85,9 @@ if (process.env.DATABASE_URL) {
<%= tab(3) %>newDb = !fs.existsSync(target)
<%= tab(2) %>}
<% } -%>
<% if (sqlite3) { -%>
<%= tab(2) %>await exec('<%= npx %> prisma migrate deploy')
<% } -%>
<% if (prismaSeed && sqlite3 && (prismaFile || prismaEnv)) { -%>
<%= tab(2) %>if (newDb) await exec('npx prisma db seed')
<% } -%>
Expand Down
3 changes: 3 additions & 0 deletions test/frameworks/next-standalone/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ COPY --from=build /app/.next/standalone /app
COPY --from=build /app/.next/static /app/.next/static
COPY --from=build /app/public /app/public

# Entrypoint sets up the container.
ENTRYPOINT [ "/app/docker-entrypoint.js" ]

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD [ "node", "server.js" ]

0 comments on commit 367ab4f

Please sign in to comment.