Merge "Fixes a test that weirdly fails in recent versions of Mojolicious"
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..b20b3cf
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,14 @@
+*
+!/Gruntfile.js
+!/kalamar.conf
+!/kalamar.dict
+!/kalamar.queries.dict
+!/LICENSE
+!/Makefile.PL
+!/package.json
+!/dev
+!/lib
+!/script
+!/t
+!/templates
+!.dockerignore
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 191ad49..aeb6634 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,32 +1,32 @@
-cache
-kalamar.secret
-start-test
-todo.org
-fixtures.txt
-sandbox
-Sandbox
-node_modules
-cache/data
-public
-kalamar.*.conf
-kalamar.conf.json
-kalamar.conf.js
-kalamar.*.dict
-!kalamar.queries.dict
-script/hypnotoad.pid
-.sass-cache
-dev/css
-dev/js/spec/src
-templates/announcement.html.ep
-templates/custom
-lib/Kalamar/Plugin/Announcements.pm
-log
-blib
-script*
-MYMETA*
-Makefile
-pm_to_blib
-t/kalamar_user_client.t
+/cache
+/kalamar.secret
+/start-test
+/todo.org
+/fixtures.txt
+/sandbox
+/Sandbox
+/node_modules
+/cache/data
+/public
+/kalamar.*.conf
+/kalamar.conf.json
+/kalamar.conf.js
+/kalamar.*.dict
+!/kalamar.queries.dict
+/script/hypnotoad.pid
+/.sass-cache
+/dev/css
+/dev/js/spec/src
+/templates/announcement.html.ep
+/templates/custom
+/lib/Kalamar/Plugin/Announcements.pm
+/log
+/blib
+/script*
+/MYMETA*
+/Makefile
+/pm_to_blib
+/t/kalamar_user_client.t
\#*
*.tar.gz
*~
@@ -35,8 +35,9 @@
*.db
*.old
.*
-t/kalamar_user_client.t
+/t/kalamar_user_client.t
!.gitignore
-npm-debug.log
-package-lock.json
+!.dockerignore
+/npm-debug.log
+/package-lock.json
/kalamar.code-workspace
\ No newline at end of file
diff --git a/Changes b/Changes
index d133553..ba17a44 100755
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-0.38 2020-05-17
+0.38 2020-06-16
- Support X-Forwarded-Host name for proxy.
- Document API URI.
- Improve redirect handling in proxy.
@@ -21,6 +21,7 @@
- Fix order of promises in login handling.
- Update Test::Mojo::Session to be compatible with latest
version of Mojolicious.
+ - Added Dockerfile.
0.37 2020-01-16
- Removed deprecated 'kalamar_test_port' helper.
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..8f0b444
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,73 @@
+# Build assets in builder image
+FROM node:12 as assetbuilder
+
+# This follows the "multi-stage build" pattern
+
+RUN npm install -g sass && \
+ npm install grunt && \
+ npm install -g grunt-cli
+
+# Copy repository respecting .dockerignore
+COPY . /kalamar
+
+RUN cd /kalamar && \
+ npm install && \
+ grunt && \
+ rm -rf node_modules \
+ dev/css \
+ dev/demo \
+ dev/font \
+ dev/img \
+ dev/scss
+
+# Use alpine linux as base image
+FROM alpine:latest
+
+# Copy assets from former container
+COPY --from=assetbuilder /kalamar /kalamar
+
+WORKDIR /kalamar
+
+RUN apk update && \
+ apk add --no-cache git \
+ perl \
+ perl-io-socket-ssl \
+ perl-dev \
+ g++ \
+ make \
+ wget \
+ curl && \
+ set -o pipefail && \
+ curl -L https://cpanmin.us | perl - App::cpanminus && \
+ cpanm git://github.com/Akron/Mojolicious-Plugin-Localize.git \
+ git://github.com/Akron/Mojolicious-Plugin-TagHelpers-ContentBlock.git && \
+ cpanm Cpanel::JSON::XS \
+ EV \
+ IO::Socket::Socks && \
+ cpanm --installdeps . -M https://cpan.metacpan.org
+
+# Remove all build dependencies
+RUN apk del git \
+ perl-dev \
+ g++ \
+ make \
+ wget \
+ curl && \
+ rm -rf /root/.cpanm \
+ /usr/local/share/man
+
+RUN addgroup -S korap && \
+ adduser -S kalamar -G korap && \
+ chown -R kalamar.korap /kalamar
+
+USER kalamar
+
+EXPOSE 64543
+
+ENTRYPOINT [ "perl", "script/kalamar" ]
+
+CMD [ "daemon", "-m", "production", "-l", "http://*:64543" ]
+
+LABEL author="korap@ids-mannheim.de"
+LABEL description="Docker Image for Kalamar, the KorAP user frontend"
+LABEL repository="https://github.com/KorAP/Kalamar"
diff --git a/Makefile.PL b/Makefile.PL
index 6f42663..9f28aaf 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -10,7 +10,9 @@
NAME => 'Kalamar',
AUTHOR => 'Nils Diewald',
BUILD_REQUIRES => {
- 'Test::More' => 0
+ 'Test::More' => 0,
+ 'Test::Mojo::Session' => 1.06,
+ 'Test::Mojo::WithRoles' => 0.02,
},
LICENSE => 'freebsd',
PREREQ_PM => {
@@ -26,8 +28,6 @@
'Cache::FastMmap' => 1.47,
'Data::Serializer' => 0.60,
'Mojo::JWT' => 0.05,
- 'Test::Mojo::Session' => 1.06,
- 'Test::Mojo::WithRoles' => 0.02,
# Required for Data::Serializer at the moment
'JSON' => 4.02,
diff --git a/package.json b/package.json
index 428c527..dbe9e07 100755
--- a/package.json
+++ b/package.json
@@ -12,7 +12,7 @@
"url": "https://github.com/KorAP/Kalamar.git"
},
"devDependencies": {
- "grunt": "^1.0.3",
+ "grunt": "^1.0.4",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-imagemin": "^3.1.0",
"grunt-contrib-requirejs": "^1.0.0",