106 lines
3.7 KiB
Docker
106 lines
3.7 KiB
Docker
# Jarvis - WASM compilation + LSP server
|
|
# Languages: TypeScript, Go, C#
|
|
|
|
FROM golang:1.23-bookworm AS builder
|
|
|
|
WORKDIR /app
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 go build -o /jarvis .
|
|
|
|
# Runtime image with all toolchains
|
|
FROM ubuntu:24.04
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
wget \
|
|
git \
|
|
ca-certificates \
|
|
build-essential \
|
|
libicu-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# ============================================
|
|
# GO + TinyGo + gopls
|
|
# ============================================
|
|
ENV GOLANG_VERSION=1.23.4
|
|
RUN wget -q https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz \
|
|
&& tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz \
|
|
&& rm go${GOLANG_VERSION}.linux-amd64.tar.gz
|
|
ENV PATH="/usr/local/go/bin:/root/go/bin:${PATH}"
|
|
|
|
RUN go install golang.org/x/tools/gopls@latest
|
|
|
|
ENV TINYGO_VERSION=0.34.0
|
|
RUN wget -q https://github.com/tinygo-org/tinygo/releases/download/v${TINYGO_VERSION}/tinygo_${TINYGO_VERSION}_amd64.deb \
|
|
&& dpkg -i tinygo_${TINYGO_VERSION}_amd64.deb \
|
|
&& rm tinygo_${TINYGO_VERSION}_amd64.deb
|
|
|
|
# ============================================
|
|
# TypeScript (extism-js + typescript-language-server)
|
|
# ============================================
|
|
ENV BINARYEN_VERSION=120
|
|
RUN wget -q https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VERSION}/binaryen-version_${BINARYEN_VERSION}-x86_64-linux.tar.gz \
|
|
&& tar -xzf binaryen-version_${BINARYEN_VERSION}-x86_64-linux.tar.gz \
|
|
&& cp binaryen-version_${BINARYEN_VERSION}/bin/* /usr/local/bin/ \
|
|
&& rm -rf binaryen-*
|
|
|
|
# extism-js (manual install - script requires sudo)
|
|
ENV EXTISM_JS_VERSION=1.5.1
|
|
RUN wget -q https://github.com/extism/js-pdk/releases/download/v${EXTISM_JS_VERSION}/extism-js-x86_64-linux-v${EXTISM_JS_VERSION}.gz \
|
|
&& gunzip extism-js-x86_64-linux-v${EXTISM_JS_VERSION}.gz \
|
|
&& mv extism-js-x86_64-linux-v${EXTISM_JS_VERSION} /usr/local/bin/extism-js \
|
|
&& chmod +x /usr/local/bin/extism-js
|
|
|
|
# Node.js for typescript-language-server
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
|
&& apt-get install -y nodejs \
|
|
&& npm install -g typescript typescript-language-server
|
|
|
|
# ============================================
|
|
# C# (.NET SDK + OmniSharp)
|
|
# ============================================
|
|
RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \
|
|
&& chmod +x dotnet-install.sh \
|
|
&& ./dotnet-install.sh --channel 9.0 --install-dir /usr/share/dotnet \
|
|
&& rm dotnet-install.sh \
|
|
&& ln -s /usr/share/dotnet/dotnet /usr/local/bin/dotnet
|
|
|
|
ENV DOTNET_ROOT=/usr/share/dotnet
|
|
ENV PATH="${PATH}:/usr/share/dotnet"
|
|
|
|
# Install WASI workload for C# WASM compilation
|
|
RUN dotnet workload install wasi-experimental
|
|
|
|
# OmniSharp for C# LSP
|
|
RUN mkdir -p /opt/omnisharp \
|
|
&& wget -q https://github.com/OmniSharp/omnisharp-roslyn/releases/download/v1.39.12/omnisharp-linux-x64-net6.0.tar.gz \
|
|
&& tar -xzf omnisharp-linux-x64-net6.0.tar.gz -C /opt/omnisharp \
|
|
&& rm omnisharp-linux-x64-net6.0.tar.gz \
|
|
&& ln -s /opt/omnisharp/OmniSharp /usr/local/bin/omnisharp
|
|
|
|
# ============================================
|
|
# Pre-warm Go dependency cache
|
|
# ============================================
|
|
RUN mkdir -p /tmp/go-warmup \
|
|
&& cd /tmp/go-warmup \
|
|
&& go mod init warmup \
|
|
&& go get github.com/extism/go-pdk@v1.0.6 \
|
|
&& rm -rf /tmp/go-warmup
|
|
|
|
# ============================================
|
|
# Jarvis server
|
|
# ============================================
|
|
WORKDIR /app
|
|
COPY --from=builder /jarvis /app/jarvis
|
|
COPY sdk /app/sdk
|
|
|
|
ENV PORT=8090
|
|
EXPOSE 8090
|
|
|
|
COPY entrypoint.sh /app/entrypoint.sh
|
|
RUN chmod +x /app/entrypoint.sh
|
|
|
|
CMD ["/app/entrypoint.sh"]
|