Skip to content
Snippets Groups Projects
Dockerfile-testing 637 B
Newer Older
  • Learn to ignore specific revisions
  • FROM docker.io/node:8-stretch as builder
    
    FORESTIER Fabien's avatar
    FORESTIER Fabien committed
    # Chromium is an headless browser that will let us run or front tests
    
    RUN apt-get update \
        && apt-get install -y chromium
    
    FORESTIER Fabien's avatar
    FORESTIER Fabien committed
    # Copy package.json first allow to cache the modules
    
    COPY ./webapp/package.json /app/webapp/package.json
    RUN cd /app/webapp; npm install
    
    COPY ./webapp /app/webapp
    
    WORKDIR /app/webapp
    
    FORESTIER Fabien's avatar
    FORESTIER Fabien committed
    # run the test command defined in the package.json
    
    RUN npm run test:ci
    
    FORESTIER Fabien's avatar
    FORESTIER Fabien committed
    COPY --from=builder /app/webapp/coverage /usr/share/nginx/html/coverage
    COPY --from=builder /app/webapp/tests /usr/share/nginx/html/tests