blob: 2a877b3bfcfeb7a03d62efdb7b852f8ef11a6978 [file] [log] [blame]
Akron17c60812020-06-15 14:29:30 +02001# Build assets in builder image
2FROM node:12 as assetbuilder
3
4# This follows the "multi-stage build" pattern
5
6RUN npm install -g sass && \
7 npm install grunt && \
8 npm install -g grunt-cli
9
10# Copy repository respecting .dockerignore
11COPY . /kalamar
12
13RUN 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
24FROM alpine:latest
25
26# Copy assets from former container
27COPY --from=assetbuilder /kalamar /kalamar
28
29WORKDIR /kalamar
30
31RUN 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
50RUN 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
59RUN addgroup -S korap && \
60 adduser -S kalamar -G korap && \
61 chown -R kalamar.korap /kalamar
62
63USER kalamar
64
Akronf7918692020-06-19 07:12:05 +020065ENV MOJO_PORT 64543
66ENV MOJO_LISTEN http://*:${MOJO_PORT}
67ENV MOJO_MODE production
68
69EXPOSE ${MOJO_PORT}
Akron17c60812020-06-15 14:29:30 +020070
71ENTRYPOINT [ "perl", "script/kalamar" ]
72
Akronf7918692020-06-19 07:12:05 +020073CMD [ "daemon" ]
Akron17c60812020-06-15 14:29:30 +020074
75LABEL author="korap@ids-mannheim.de"
76LABEL description="Docker Image for Kalamar, the KorAP user frontend"
77LABEL repository="https://github.com/KorAP/Kalamar"