Fix Gleam compilation in Docker builds

- Mark gleam_stdlib and gleeunit with compile: false in mix.exs
- Copy pre-compiled Gleam BEAM files in Dockerfile
- Add explicit mix gleam_compile step before asset compilation
- Ensure priv/gleam directory is included in Docker build

This fixes the "Could not compile :gleam_stdlib" error during deployment.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Graham McIntire 2025-07-18 15:11:08 -05:00
parent 18521ed0c1
commit 1a84eb594a
No known key found for this signature in database
3 changed files with 10 additions and 9 deletions

View file

@ -43,9 +43,12 @@ COPY rel rel
# Copy Gleam source files and configuration
COPY src src
COPY gleam.toml gleam.toml
# Ensure pre-compiled Gleam BEAM files are available
# This helps when mix_gleam or gleam binary are not available
RUN mkdir -p priv/gleam
# Copy pre-compiled Gleam BEAM files
# This is crucial for production builds where gleam compiler is not available
COPY priv/gleam priv/gleam
# Compile Gleam files (using pre-compiled BEAM files)
RUN mix gleam_compile
# Compile assets
RUN mix assets.deploy

View file

@ -64,10 +64,8 @@
</script>
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>
</script>
<script
src="https://js.sentry-cdn.com/be4b53768e7c243cc72fa78ee7b7ec8c.min.js"
crossorigin="anonymous"
></script>
<script src="https://js.sentry-cdn.com/be4b53768e7c243cc72fa78ee7b7ec8c.min.js" crossorigin="anonymous">
</script>
</head>
<body class={body_class(assigns)}>
{@inner_content}

View file

@ -115,8 +115,8 @@ defmodule Aprsme.MixProject do
{:gettext_pseudolocalize, "~> 0.1"},
{:sentry, "~> 11.0"},
# Gleam dependencies
{:gleam_stdlib, ">= 0.60.0 and < 1.0.0", app: false, override: true},
{:gleeunit, "~> 1.0", only: [:dev, :test], runtime: false, app: false}
{:gleam_stdlib, ">= 0.60.0 and < 1.0.0", app: false, compile: false, override: true},
{:gleeunit, "~> 1.0", only: [:dev, :test], runtime: false, app: false, compile: false}
]
end