Browse Source

Add docker container for testing

Oliv4945 4 months ago
parent
commit
ac1e6e6454
No account linked to committer's email address
2 changed files with 41 additions and 0 deletions
  1. 27
    0
      Dockerfile
  2. 14
    0
      karma.conf.js

+ 27
- 0
Dockerfile View File

@@ -0,0 +1,27 @@
1
+FROM node:lts-stretch-slim
2
+
3
+# Install Ruby & Bourbon
4
+# Only required once to init project
5
+# RUN apk update && apk upgrade && apk --update add \
6
+#     ruby ruby-dev ruby-ffi ruby-irb ruby-rake ruby-io-console ruby-bigdecimal ruby-json ruby-bundler \
7
+#     libstdc++ tzdata bash ca-certificates \
8
+#     && echo 'gem: --no-document' > /etc/gemrc
9
+# RUN gem install bourbon
10
+
11
+RUN apt-get update && \
12
+    apt-get install -y chromium firefox-esr && \
13
+    rm -rf /var/lib/apt/
14
+
15
+# Install node packages
16
+RUN npm install -g grunt-cli
17
+
18
+# Environment vars
19
+ENV DOCKER="True"
20
+
21
+# Copy files
22
+RUN mkdir -p /passman
23
+WORKDIR /passman
24
+COPY . /passman
25
+
26
+# Install project dependencies
27
+RUN npm install

+ 14
- 0
karma.conf.js View File

@@ -1,10 +1,14 @@
1 1
 // Karma configuration
2 2
 // Generated on Mon Oct 17 2016 15:46:52 GMT+0200 (CEST)
3 3
 var isTravis = (process.env.TRAVIS_BUILD_NUMBER) ? true : false;
4
+var isDocker = (process.env.DOCKER) ? true : false;
4 5
 var browsers = ['Firefox'];
5 6
 if(!isTravis){
6 7
     browsers = ['Chrome'];
7 8
 }
9
+if(isDocker){
10
+    browsers = ['Chromium_Docker', 'Firefox_Docker'];
11
+}
8 12
 module.exports = function (config) {
9 13
     config.set({
10 14
 
@@ -62,6 +66,16 @@ module.exports = function (config) {
62 66
         // start these browsers
63 67
         // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
64 68
         browsers: browsers,
69
+        customLaunchers: {
70
+            Chromium_Docker: {
71
+              base: 'Chromium',
72
+              flags: ['--headless', '--disable-gpu', '--remote-debugging-port=9222', '--no-sandbox']
73
+            },
74
+            Firefox_Docker: {
75
+                base: 'Firefox',
76
+                flags: ['--headless']
77
+              }
78
+          },
65 79
 
66 80
 
67 81
         // Continuous Integration mode