#Docker build failing but local one doesn't

1 messages · Page 1 of 1 (latest)

sand bramble
#

Hi, out of the blue the docker build for MCP packages started having issues starting the main app and I can't figure why. Here's the docker file and the repository :

# Use the official Gleam image with Erlang
FROM ghcr.io/gleam-lang/gleam:v1.12.0-erlang-alpine AS build


# Set working directory and copy source
WORKDIR /app
COPY . .

# Force cache bust with timestamp and clean rebuild
RUN date > /tmp/build_time && rm -rf build && gleam export erlang-shipment

FROM erlang:27.1.1.0-alpine 

# Install system dependencies first
RUN apk add --no-cache git

COPY --from=build /app/build/erlang-shipment /app

RUN mkdir -p /app/.local/share /app/.cache /tmp /data /app/docs_cache
RUN chmod 755 /app/.local/share /app/.cache /tmp /data /app/docs_cache
RUN chown -R gleam:gleam /data || chown -R 1000:1000 /data || true
EXPOSE 3000
ENV PORT=3000
ENV HOME=/app
WORKDIR /app
ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["run"]
#

This are the production logs:

2025-09-22T11:38:20.354 app[91859d5dc12348] fra [info] INFO [fly api proxy] listening at /.fly/api

2025-09-22T11:38:20.428 runner[91859d5dc12348] fra [info] Machine started in 1.452s

2025-09-22T11:38:20.855 app[91859d5dc12348] fra [info] 2025/09/22 11:38:20 INFO SSH listening listen_address=[fdaa:a:a0aa:a7b:546:c3ea:d148:2]:22

2025-09-22T11:38:21.143 app[91859d5dc12348] fra [info] Error! Failed to eval: mcp_packages@@main:run(mcp_packages)

2025-09-22T11:38:21.149 app[91859d5dc12348] fra [info] Runtime terminating during boot ({undef,[{'mcp_packages@@main',run,[mcp_packages],[]},{erl_eval,do_apply,7,[{file,"erl_eval.erl"},{line,900}]},{init,start_it,1,[]},{init,start_em,1,[]},{init,do_boot,3,[]}]})
#

Its weird because the other day it was working just fine but now it has a undef issue

#

And locally the server starts just fine

thorny pelican
#

is mcp_packages the app?

sand bramble
#

yes

thorny pelican
#

Can't see anything obviously wrong

#

Does that .beam file exist in the image?

sand bramble
#

leme check

thorny pelican
#

btw gunna be a bit tricky to ensure that the Erlang versions are the same in both images if you build like that because it's explicitly specified in the Erlang one but implicit in the Gleam one. You might wanna use this approach instead

#

Using the same Erlang image twice and just copying Gleam into it

sand bramble
#

lemme try that

thorny pelican
#

Don't think it should fail here though

sand bramble
#

It looks like that was the issue!

#

Locally now it works

thorny pelican
#

hmm weird

sand bramble
#

Deployed and working

#

thanks

#

still weird tho

thorny pelican
#

yeah idk what it was

sand bramble
outer karma
thorny pelican
#

Caching, and it can verify the checksum for you

#

and you don't need to install wget

outer karma
thorny pelican
#

Yup