2026-05-10 12:23:05 +02:00
|
|
|
# syntax=docker/dockerfile:1.6
|
|
|
|
|
# iLSP — multi-stage: downloads Bicep LS, then builds the Python package
|
|
|
|
|
# Final image: dotnet runtime + Python 3.12
|
|
|
|
|
|
|
|
|
|
# ── Stage 1: download Bicep Language Server ──────────────────────────────────
|
|
|
|
|
FROM debian:bookworm-slim AS bicep-downloader
|
|
|
|
|
|
|
|
|
|
ARG BICEP_VERSION=latest
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends curl unzip ca-certificates \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
COPY scripts/download_bicep_ls.sh /scripts/
|
|
|
|
|
RUN chmod +x /scripts/download_bicep_ls.sh && BICEP_VERSION=${BICEP_VERSION} /scripts/download_bicep_ls.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ── Stage 2: Python wheel build ───────────────────────────────────────────────
|
|
|
|
|
FROM python:3.12-slim AS builder
|
|
|
|
|
|
|
|
|
|
WORKDIR /build
|
|
|
|
|
COPY pyproject.toml .
|
|
|
|
|
COPY ilsp/ ilsp/
|
2026-05-10 13:40:48 +02:00
|
|
|
COPY bicep_modules_catalog.json .
|
2026-05-10 12:23:05 +02:00
|
|
|
|
|
|
|
|
RUN pip install --upgrade pip build \
|
|
|
|
|
&& python -m build --wheel --outdir /dist
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ── Stage 3: final runtime ────────────────────────────────────────────────────
|
2026-05-10 12:43:09 +02:00
|
|
|
# Use Microsoft's official .NET runtime image — avoids the SHA1-signed APT key
|
|
|
|
|
# issue on newer Debian hosts (trixie+ rejects packages.microsoft.com GPG since 2026-02-01).
|
2026-05-10 13:02:52 +02:00
|
|
|
FROM mcr.microsoft.com/dotnet/runtime:10.0
|
2026-05-10 12:23:05 +02:00
|
|
|
|
2026-05-10 15:40:13 +02:00
|
|
|
# Install Python 3 + pip + Node.js (for yaml-language-server)
|
2026-05-10 12:23:05 +02:00
|
|
|
RUN apt-get update \
|
|
|
|
|
&& apt-get install -y --no-install-recommends \
|
2026-05-10 15:40:13 +02:00
|
|
|
python3 python3-pip wget nodejs npm \
|
|
|
|
|
&& npm install -g yaml-language-server \
|
2026-05-10 12:23:05 +02:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
# Copy Bicep Language Server (baked in at build time — no volume needed)
|
|
|
|
|
COPY --from=bicep-downloader /opt/bicep-langserver /opt/bicep-langserver
|
|
|
|
|
|
|
|
|
|
# Install Python package and dependencies
|
|
|
|
|
COPY --from=builder /dist/*.whl /tmp/
|
2026-05-10 13:40:48 +02:00
|
|
|
COPY --from=builder /build/bicep_modules_catalog.json /bicep_modules_catalog.json
|
2026-05-10 12:43:09 +02:00
|
|
|
RUN pip3 install --no-cache-dir --break-system-packages /tmp/*.whl && rm /tmp/*.whl
|
2026-05-10 12:23:05 +02:00
|
|
|
|
|
|
|
|
# Configuration defaults (override via Nomad env)
|
|
|
|
|
ENV PYTHON_LSP_PORT=2087 \
|
|
|
|
|
BICEP_LSP_PORT=2088 \
|
2026-05-10 15:40:13 +02:00
|
|
|
YAML_LSP_PORT=2090 \
|
2026-05-10 12:23:05 +02:00
|
|
|
HEALTH_PORT=2089 \
|
|
|
|
|
BICEP_LS_PATH=/opt/bicep-langserver/Bicep.LangServer.dll \
|
|
|
|
|
DEVOPS_MCP_URL=https://devops-mcp.i80.dk \
|
|
|
|
|
PYTHONUNBUFFERED=1
|
|
|
|
|
|
|
|
|
|
EXPOSE 2087 2088 2089
|
|
|
|
|
|
|
|
|
|
HEALTHCHECK --interval=15s --timeout=5s --retries=3 \
|
|
|
|
|
CMD wget -qO- http://localhost:${HEALTH_PORT}/health || exit 1
|
|
|
|
|
|
|
|
|
|
CMD ["ilsp"]
|