blob: 8f0b4444559adc347197f4c96b16250992a52773 [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
65EXPOSE 64543
66
67ENTRYPOINT [ "perl", "script/kalamar" ]
68
69CMD [ "daemon", "-m", "production", "-l", "http://*:64543" ]
70
71LABEL author="korap@ids-mannheim.de"
72LABEL description="Docker Image for Kalamar, the KorAP user frontend"
73LABEL repository="https://github.com/KorAP/Kalamar"