From 65f0f23c93a8a5b792eba4e77af00f47e7ede03f Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Fri, 30 Jan 2026 13:04:06 -0600 Subject: [PATCH] fix: compile C NIF explicitly in Docker build Add explicit 'make' step in Dockerfile to compile the C NIF before Elixir compilation. This ensures towerops_nif.so exists when the Elixir code tries to load it. The custom compiler task creates a bootstrap problem (needs to be compiled before it can be used as a compiler), so we compile the C NIF explicitly instead of relying on the compilers list. --- Dockerfile | 3 +++ mix.exs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0ae14564..8e4af904 100644 --- a/Dockerfile +++ b/Dockerfile @@ -65,6 +65,9 @@ COPY priv priv COPY c_src c_src +# Compile the C NIF before Elixir compilation +RUN cd c_src && make + COPY lib lib # Compile the release diff --git a/mix.exs b/mix.exs index 2c84be3f..c9ee30c9 100644 --- a/mix.exs +++ b/mix.exs @@ -10,7 +10,7 @@ defmodule Towerops.MixProject do start_permanent: Mix.env() == :prod, aliases: aliases(), deps: deps(), - compilers: [:towerops_nif, :phoenix_live_view] ++ Mix.compilers(), + compilers: [:phoenix_live_view] ++ Mix.compilers(), listeners: [Phoenix.CodeReloader], dialyzer: dialyzer() ]