From 00e853de7a59a731bda88018bdd79357b0b34f36 Mon Sep 17 00:00:00 2001 From: Jacek Wielemborek Date: Sat, 25 Oct 2025 20:07:19 +0200 Subject: [PATCH] refactor(docker): replace RUN_TESTS ARG with test stage - Removed ARG RUN_TESTS and conditional if block - Added dedicated 'test' stage for quality checks - Usage: docker build --target test -t rentgen-test . - Cleaner separation of concerns - Updated README with new command --- Dockerfile | 13 +++---------- README.md | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 62494cb..e3ca3fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,6 @@ # Build stage FROM node:lts AS builder -# Optional: run tests during build (typecheck + lint) -ARG RUN_TESTS=false - WORKDIR /app # Copy package files for dependency installation (better layer caching) @@ -24,13 +21,9 @@ RUN npm run build # Create the package RUN npm run create-package -# Optional: run quality checks -RUN if [ "$RUN_TESTS" = "true" ]; then \ - echo "Running TypeScript type checking..."; \ - npm run typecheck; \ - echo "Running web-ext lint..."; \ - npm run lint; \ - fi +# 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 diff --git a/README.md b/README.md index 113c361..9d3e459 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ This will build the extension and extract the `.zip` file to the `artifacts/` di ### Build with tests (typecheck + lint) ```bash -docker build --build-arg RUN_TESTS=true -t rentgen . +docker build --target test -t rentgen-test . ``` ### Traditional build (creates full development environment)