Akron | 17c6081 | 2020-06-15 14:29:30 +0200 | [diff] [blame] | 1 | # Build assets in builder image |
| 2 | FROM node:12 as assetbuilder |
| 3 | |
| 4 | # This follows the "multi-stage build" pattern |
| 5 | |
| 6 | RUN npm install -g sass && \ |
| 7 | npm install grunt && \ |
| 8 | npm install -g grunt-cli |
| 9 | |
| 10 | # Copy repository respecting .dockerignore |
| 11 | COPY . /kalamar |
| 12 | |
| 13 | RUN cd /kalamar && \ |
| 14 | npm install && \ |
| 15 | grunt && \ |
| 16 | rm -rf node_modules \ |
| 17 | dev/css \ |
| 18 | dev/demo \ |
| 19 | dev/font \ |
| 20 | dev/img \ |
Akron | 64b957d | 2020-10-07 22:39:53 +0200 | [diff] [blame^] | 21 | dev/js/bench \ |
| 22 | dev/js/runner \ |
| 23 | dev/js/spec \ |
| 24 | dev/scss && \ |
| 25 | rm package-lock.json \ |
| 26 | dev/robots.txt |
Akron | 17c6081 | 2020-06-15 14:29:30 +0200 | [diff] [blame] | 27 | |
| 28 | # Use alpine linux as base image |
| 29 | FROM alpine:latest |
| 30 | |
| 31 | # Copy assets from former container |
| 32 | COPY --from=assetbuilder /kalamar /kalamar |
| 33 | |
| 34 | WORKDIR /kalamar |
| 35 | |
| 36 | RUN apk update && \ |
| 37 | apk add --no-cache git \ |
| 38 | perl \ |
| 39 | perl-io-socket-ssl \ |
| 40 | perl-dev \ |
| 41 | g++ \ |
| 42 | make \ |
| 43 | wget \ |
| 44 | curl && \ |
| 45 | set -o pipefail && \ |
| 46 | curl -L https://cpanmin.us | perl - App::cpanminus && \ |
| 47 | cpanm git://github.com/Akron/Mojolicious-Plugin-Localize.git \ |
| 48 | git://github.com/Akron/Mojolicious-Plugin-TagHelpers-ContentBlock.git && \ |
| 49 | cpanm Cpanel::JSON::XS \ |
| 50 | EV \ |
| 51 | IO::Socket::Socks && \ |
| 52 | cpanm --installdeps . -M https://cpan.metacpan.org |
| 53 | |
| 54 | # Remove all build dependencies |
| 55 | RUN apk del git \ |
| 56 | perl-dev \ |
| 57 | g++ \ |
| 58 | make \ |
| 59 | wget \ |
| 60 | curl && \ |
| 61 | rm -rf /root/.cpanm \ |
Akron | 64b957d | 2020-10-07 22:39:53 +0200 | [diff] [blame^] | 62 | /usr/local/share/man && \ |
| 63 | rm -rf t |
Akron | 17c6081 | 2020-06-15 14:29:30 +0200 | [diff] [blame] | 64 | |
| 65 | RUN addgroup -S korap && \ |
| 66 | adduser -S kalamar -G korap && \ |
| 67 | chown -R kalamar.korap /kalamar |
| 68 | |
| 69 | USER kalamar |
| 70 | |
Akron | f791869 | 2020-06-19 07:12:05 +0200 | [diff] [blame] | 71 | ENV MOJO_PORT 64543 |
| 72 | ENV MOJO_LISTEN http://*:${MOJO_PORT} |
| 73 | ENV MOJO_MODE production |
| 74 | |
| 75 | EXPOSE ${MOJO_PORT} |
Akron | 17c6081 | 2020-06-15 14:29:30 +0200 | [diff] [blame] | 76 | |
| 77 | ENTRYPOINT [ "perl", "script/kalamar" ] |
| 78 | |
Akron | f791869 | 2020-06-19 07:12:05 +0200 | [diff] [blame] | 79 | CMD [ "daemon" ] |
Akron | 17c6081 | 2020-06-15 14:29:30 +0200 | [diff] [blame] | 80 | |
Akron | 728bbe0 | 2020-07-03 17:34:07 +0200 | [diff] [blame] | 81 | LABEL maintainer="korap@ids-mannheim.de" |
Akron | 17c6081 | 2020-06-15 14:29:30 +0200 | [diff] [blame] | 82 | LABEL description="Docker Image for Kalamar, the KorAP user frontend" |
| 83 | LABEL repository="https://github.com/KorAP/Kalamar" |