- Replace Alpine with Debian Slim for the runtime environment - Update curl installation process to use apt-get for compatibility
39 lines
1.1 KiB
Docker
39 lines
1.1 KiB
Docker
# -------- Stage 1: Build the Deno application --------
|
|
FROM denoland/deno:latest AS builder
|
|
|
|
# Set the working directory inside the builder container
|
|
WORKDIR /app
|
|
|
|
# Copy the application source code and configuration files
|
|
COPY src/ ./src/
|
|
COPY deno.jsonc ./deno.jsonc
|
|
COPY import_map.json ./import_map.json
|
|
|
|
# Compile the application to a self-contained native binary
|
|
# Permissions and flags should be specified during compile time
|
|
RUN deno task compile
|
|
|
|
# -------- Stage 2: Minimal runtime environment --------
|
|
FROM debian:bookworm-slim
|
|
|
|
# Optional: Install curl for container-level health checks
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy only the compiled application binary from the builder stage
|
|
COPY --from=builder /app/app /app/app
|
|
|
|
# Set the working directory for the runtime container
|
|
WORKDIR /app
|
|
|
|
# Define expected environment variables (can be overridden at runtime)
|
|
ENV PROXY_HOST=0.0.0.0
|
|
ENV PROXY_PORT=8011
|
|
ENV LT_SERVER_HOST=localhost
|
|
ENV LT_SERVER_PORT=8010
|
|
ENV API_KEYS=demo-key
|
|
|
|
# Define the default command to run the application binary
|
|
CMD ["/app/app"]
|