Commit 29fa12d9 authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

added Puppeteer and Chromium dependencies

parent 67c79a93
Pipeline #32754 failed with stages
in 9 minutes and 49 seconds
......@@ -27,7 +27,7 @@ build:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
- docker build ./mc_frontend -t $FRONTEND_IMAGE
- docker push $FRONTEND_IMAGE
- docker build ./mc_frontend -t $BACKEND_IMAGE
- docker build ./mc_backend -t $BACKEND_IMAGE
- docker push $BACKEND_IMAGE
variables:
DOCKER_DRIVER: overlay2
......@@ -42,7 +42,7 @@ ci_frontend:
- docker:20.10.8-dind
stage: ci
script:
- docker run --rm --entrypoint="npm run test-ci" $FRONTEND_IMAGE > ci_frontend.log
- docker run --rm $FRONTEND_IMAGE npm run test-ci > ci_frontend.log
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
......
docker-compose build
docker-compose run --rm --entrypoint="npm run test-ci" mc_frontend > ci_frontend.log
docker-compose run --rm mc_frontend npm run test-ci > ci_frontend.log
docker-compose run --rm --entrypoint="./coverage_backend.sh" mcserver > ci_backend.log
./coverage_ci.sh
cat coverage.log
......@@ -17,6 +17,7 @@ services:
entrypoint: ng build --prod app
environment:
- CHROME_BIN=google-chrome
image: konstantinschulz/mc_frontend:latest
volumes:
- ./mc_frontend/www:/home/mc/mc_frontend/www
mcserver:
......@@ -30,6 +31,7 @@ services:
- FLASK_APP=app.py
- IS_THIS_A_DOCKER_CONTAINER=Yes
- PYTHONPATH=/home/mc
image: konstantinschulz/mcserver:latest
ports:
- "5000:5000"
restart: always
......
FROM node:14.17.6-stretch-slim as BUILD_IMAGE
# python version in this container is 3.5.3
RUN useradd -ms /bin/bash mc
WORKDIR /home/mc
RUN apt update
# for testing with headless chrome browser
RUN apt install -y wget
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt install -y ./google-chrome-stable_current_amd64.deb
FROM node:14.17.6-slim as BUILD_IMAGE
WORKDIR /home/mc/mc_frontend
COPY package.json .
RUN npm install
## use multi-stage image to reduce Docker image size
#FROM python:3.8-slim as PYTHON_IMAGE
#WORKDIR /home/mc/mc_frontend
#RUN apt update
#RUN apt install -y git
#COPY update_version.py .
#COPY src src
#RUN python3 update_version.py
FROM node:14.17.6-stretch-slim
FROM node:14.17.6-slim
WORKDIR /home/mc/mc_frontend
RUN apt-get update
# install Chromium dependencies
RUN apt-get install -y libasound2 libatk1.0-0 libatk-bridge2.0-0 libcairo2 libcups2 libdrm-dev libgbm1 libnss3 \
libpango-1.0-0 libxcomposite1 libxdamage1 libxkbcommon-dev libxrandr2 libxshmfence-dev
# copy package.json so we can generate a clean lock file
COPY package.json .
# add Puppeteer manually because it will also install Chromium
RUN npm install -D puppeteer
COPY --from=BUILD_IMAGE /home/mc/mc_frontend/node_modules node_modules
# to get the version of the local CLI package, run: npm list @angular/cli | sed 's/[^0-9.]*//g' | sed -n 2p
RUN npm i -g @angular/cli
# this makes the analytics prompt during upcoming "npm install" disappear, so this can also run in CI
RUN ng analytics off
COPY . .
#COPY --from=PYTHON_IMAGE /home/mc/mc_frontend/src/version.ts src/version.ts
COPY ./config.xml ./www/config.xml
# workaround to fix the missing binding issue for node-sass
RUN npm rebuild node-sass
......
This diff is collapsed.
......@@ -72,6 +72,7 @@
"karma-jasmine": "^3.1.1",
"karma-jasmine-html-reporter": "^1.5.2",
"protractor": "^5.4.3",
"puppeteer": "^10.4.0",
"ts-node": "^8.1.1",
"tslint": "~5.16.0",
"typescript": "^3.6.5"
......
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
const process = require('process');
process.env.CHROME_BIN = require('puppeteer').executablePath();
module.exports = function (config) {
config.set({
basePath: '',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment