diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6ff0028 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +# -------- 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 denoland/deno:alpine + +# Optional: Install curl for container-level health checks (not needed for production-only binaries) +RUN apk add --no-cache curl + +# 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"]