File size: 695 Bytes
273ed4b
 
1474b95
273ed4b
 
 
 
 
22321ff
273ed4b
 
 
22321ff
1474b95
273ed4b
b12c222
d0b8e8f
273ed4b
 
1c4f483
1474b95
d0b8e8f
1474b95
273ed4b
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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"]