Ctrl K
ComunidadGuías…

Dockerfile.build

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
FROM rust:slim AS builder

RUN apt-get update && apt-get install -y --no-install-recommends \
    curl \
    ca-certificates \
    build-essential \
    pkg-config \
    libssl-dev \
    llvm-dev \
    libclang-dev \
    clang \
    cmake \
    && rm -rf /var/lib/apt/lists/*

RUN cargo install wasm-tools --locked

# Worker builds the types to embed the schema validator
COPY .node-version .node-version
RUN curl --fail -sSf https://raw.githubusercontent.com/creationix/nvm/v0.40.3/install.sh | bash
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install "$(cat .node-version)"
RUN . "$NVM_DIR/nvm.sh" && nvm use "v$(cat .node-version)"
RUN . "$NVM_DIR/nvm.sh" && nvm alias default "v$(cat .node-version)"
RUN ln -s "$NVM_DIR/versions/node/v$(cat .node-version)" "$NVM_DIR/versions/node/default"
ENV PATH="$NVM_DIR/versions/node/default/bin/:${PATH}"
RUN node --version
RUN npm --version

COPY package.json .
RUN npm install -g pnpm@$(node -e "console.log(require('./package.json').packageManager.split('@')[1])")

WORKDIR /app

COPY . .

RUN pnpm install --frozen-lockfile

RUN cargo build --target wasm32-wasip2 -p kyushu-worker --release

# We use the local component for testing. The Dockerfile.build is not used to release the CLI.
RUN cargo build -p kyushu-cli --release --features local-worker

FROM scratch AS export

COPY --from=builder /app/target/wasm32-wasip2/release/kyushu_worker.wasm /
COPY --from=builder /app/target/release/kyu /