forked from icd/rentgen
Added: - Makefile with verify target that runs docker compose - New 'verify' stage in Dockerfile for automated testing - Added rentgen_verify service to compose.yml - Verification exits with proper exit code (0=success, non-zero=failure) The make verify command: 1. Builds extension with docker compose 2. Runs test_verify.sh in headless Firefox 3. Propagates exit code from verification script 4. Fails if no proof of code execution found Usage: make verify 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
69 lines
1.6 KiB
Docker
69 lines
1.6 KiB
Docker
# Rentgen Browser Extension - Docker Build
|
|
# See README.md for detailed usage instructions
|
|
|
|
# Build stage
|
|
FROM node:lts AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files for dependency installation (better layer caching)
|
|
COPY package.json package-lock.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm install
|
|
|
|
# Copy source code (respecting .dockerignore)
|
|
COPY . .
|
|
|
|
# Build the extension for Firefox (default)
|
|
RUN npm run build
|
|
|
|
# Create the package
|
|
RUN npm run create-package
|
|
|
|
# Test stage - for running quality checks
|
|
FROM builder AS test
|
|
RUN npm run typecheck && npm run lint
|
|
|
|
# Artifacts stage - only contains the built artifacts (for --output)
|
|
FROM scratch AS artifacts
|
|
|
|
# Copy only the built extension zip file to root
|
|
COPY --from=builder /app/web-ext-artifacts/*.zip /
|
|
|
|
# Default stage - full development environment
|
|
FROM builder
|
|
|
|
# Default command shows the built artifact
|
|
CMD ["ls", "-lh", "/app/web-ext-artifacts/"]
|
|
|
|
# Runtime stage - for running extension in Firefox
|
|
FROM builder AS runtime
|
|
|
|
# Install Firefox and Xvfb for headless execution
|
|
RUN apt-get update && apt-get install -y \
|
|
firefox-esr \
|
|
xvfb \
|
|
procps \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set display for Xvfb
|
|
ENV DISPLAY=:99
|
|
|
|
# Copy startup script for extension testing
|
|
COPY scripts/test_start_extension.sh /app/test_start_extension.sh
|
|
RUN chmod +x /app/test_start_extension.sh
|
|
|
|
# Start script
|
|
CMD ["/app/test_start_extension.sh"]
|
|
|
|
# Verify stage - automated testing with exit code
|
|
FROM runtime AS verify
|
|
|
|
# Copy verification script
|
|
COPY scripts/test_verify.sh /app/test_verify.sh
|
|
RUN chmod +x /app/test_verify.sh
|
|
|
|
# Run verification and exit with proper exit code
|
|
CMD ["/app/test_verify.sh"]
|