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 \ |
| 21 | dev/scss |
| 22 | |
| 23 | # Use alpine linux as base image |
| 24 | FROM alpine:latest |
| 25 | |
| 26 | # Copy assets from former container |
| 27 | COPY --from=assetbuilder /kalamar /kalamar |
| 28 | |
| 29 | WORKDIR /kalamar |
| 30 | |
| 31 | RUN apk update && \ |
| 32 | apk add --no-cache git \ |
| 33 | perl \ |
| 34 | perl-io-socket-ssl \ |
| 35 | perl-dev \ |
| 36 | g++ \ |
| 37 | make \ |
| 38 | wget \ |
| 39 | curl && \ |
| 40 | set -o pipefail && \ |
| 41 | curl -L https://cpanmin.us | perl - App::cpanminus && \ |
| 42 | cpanm git://github.com/Akron/Mojolicious-Plugin-Localize.git \ |
| 43 | git://github.com/Akron/Mojolicious-Plugin-TagHelpers-ContentBlock.git && \ |
| 44 | cpanm Cpanel::JSON::XS \ |
| 45 | EV \ |
| 46 | IO::Socket::Socks && \ |
| 47 | cpanm --installdeps . -M https://cpan.metacpan.org |
| 48 | |
| 49 | # Remove all build dependencies |
| 50 | RUN apk del git \ |
| 51 | perl-dev \ |
| 52 | g++ \ |
| 53 | make \ |
| 54 | wget \ |
| 55 | curl && \ |
| 56 | rm -rf /root/.cpanm \ |
| 57 | /usr/local/share/man |
| 58 | |
| 59 | RUN addgroup -S korap && \ |
| 60 | adduser -S kalamar -G korap && \ |
| 61 | chown -R kalamar.korap /kalamar |
| 62 | |
| 63 | USER kalamar |
| 64 | |
Akron | f791869 | 2020-06-19 07:12:05 +0200 | [diff] [blame^] | 65 | ENV MOJO_PORT 64543 |
| 66 | ENV MOJO_LISTEN http://*:${MOJO_PORT} |
| 67 | ENV MOJO_MODE production |
| 68 | |
| 69 | EXPOSE ${MOJO_PORT} |
Akron | 17c6081 | 2020-06-15 14:29:30 +0200 | [diff] [blame] | 70 | |
| 71 | ENTRYPOINT [ "perl", "script/kalamar" ] |
| 72 | |
Akron | f791869 | 2020-06-19 07:12:05 +0200 | [diff] [blame^] | 73 | CMD [ "daemon" ] |
Akron | 17c6081 | 2020-06-15 14:29:30 +0200 | [diff] [blame] | 74 | |
| 75 | LABEL author="korap@ids-mannheim.de" |
| 76 | LABEL description="Docker Image for Kalamar, the KorAP user frontend" |
| 77 | LABEL repository="https://github.com/KorAP/Kalamar" |