Files
terminus/scripts/docker/entrypoint
Brooke Kuhlmann cf67bc93a0 Added Docker entrypoint conditional setup for assets and migrations
Necessary to ensure assets and migrations are only setup for the _web_ service. This ensures other services, like the _worker_ service, don't end up duplicating this work. The new `APP_SETUP` environment variable controls this behavior and works for both Docker and Render.

The original idea stems from Max but has been modified to support both assets _and_ migrations.

This also fixes a typo in the `compose.dev.yml.tt` to do not adding the end quote in the right place.

Co-authored-by: Max Forasteiro <18661016+maxforasteiro@users.noreply.github.com>
Milestone: minor
2026-01-06 11:32:15 -07:00

17 lines
393 B
Ruby
Executable File

#! /usr/bin/env ruby
# frozen_string_literal: true
$VERBOSE = true
jemalloc_path = Dir["/usr/lib/*/libjemalloc.so.2"]
ENV["LD_PRELOAD"] = jemalloc_path.first unless ENV.key?("LD_PRELOAD") || jemalloc_path.empty?
if ENV["APP_SETUP"] == "true"
system "bundle exec hanami assets compile"
system "bundle exec hanami db migrate"
else
puts "Application is setup. Skipped."
end
exec(*ARGV)