Dockerfile raw

   1  # Build the Smesh Signer browser extension from source.
   2  #
   3  # Usage:
   4  #   docker build -t smesh-signer-build .
   5  #   docker run --rm -v $(pwd)/out:/out smesh-signer-build
   6  #
   7  # Output:
   8  #   out/firefox/              Unpacked extension (load in about:debugging)
   9  #   out/smesh_signer-*.zip    Signed/packaged XPI
  10  
  11  FROM oven/bun:1-debian AS builder
  12  
  13  WORKDIR /ext
  14  
  15  # Install deps first (cache layer)
  16  COPY package.json bun.lock ./
  17  RUN bun install --frozen-lockfile
  18  
  19  # Copy source
  20  COPY angular.json tsconfig*.json custom-webpack.config.ts eslint.config.js ./
  21  COPY src/ src/
  22  COPY public/ public/
  23  COPY common/ common/
  24  
  25  # Build Firefox extension
  26  RUN bun run build:firefox
  27  
  28  # Package XPI
  29  RUN bunx web-ext build --source-dir dist/firefox --artifacts-dir dist --overwrite-dest
  30  
  31  # Copy stage: extract built artifacts
  32  FROM debian:bookworm-slim
  33  
  34  RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/*
  35  
  36  WORKDIR /ext
  37  
  38  COPY --from=builder /ext/dist/ /ext/dist/
  39  
  40  # Default: copy artifacts to /out (mount a volume)
  41  CMD ["sh", "-c", "cp -r /ext/dist/* /out/ && echo 'Extension built to /out/'"]
  42