| # Use the official production-grade Gleam + Erlang Alpine image | |
| FROM ghcr.io/gleam-lang/gleam:v1.15.4-erlang-alpine | |
| # Set up a non-root user matching Hugging Face permissions (ID 1000) | |
| RUN adduser -u 1000 -D appuser | |
| WORKDIR /app | |
| # Copy dependency files first to utilize caching layers | |
| COPY gleam.toml manifest.toml ./ | |
| RUN gleam deps download | |
| # Copy the rest of your application code | |
| COPY src ./src | |
| # Pre-compile the application so it boots up instantly at runtime | |
| RUN gleam build | |
| # Give the non-root user control over the application workspace | |
| RUN chown -R appuser:appuser /app | |
| USER appuser | |
| EXPOSE 7860 | |
| # Run the app directly using the Gleam production command engine | |
| CMD ["gleam", "run"] |