summaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2020-01-02 22:19:39 +0100
committertomsmeding <tom.smeding@gmail.com>2020-01-02 22:44:37 +0100
commit08bf951fb7f9d976bb9f2d9ffd7376fab2b764cf (patch)
treef1a9afe6c976e50439c2125a350bf7f52028e5b2 /Dockerfile
parentb41a370dfc8e602eca6c0b37a6eac22e8de8e1bb (diff)
Let abbrgen work in Docker
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile26
1 files changed, 23 insertions, 3 deletions
diff --git a/Dockerfile b/Dockerfile
index 2b38630..ad2bb69 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,9 +1,29 @@
-FROM alpine:3.11
+FROM alpine:3.11 AS builder
-RUN apk add --no-cache nodejs npm
+RUN apk add --no-cache npm g++
WORKDIR /webserver
+
+# Get a word list for the abbrgen module
+RUN wget 'http://app.aspell.net/create?max_size=60&spelling=GBs&max_variant=0&diacritic=strip&special=hacker&download=wordlist&encoding=utf-8&format=inline' -O words && \
+ printf "1,/---/ d\nw\nq\n" | ed words >/dev/null
+
COPY . .
-RUN npm install
+# The --unsafe-perm flag is to allow building the abbreviation_gen executable
+RUN npm install --unsafe-perm
+
+
+#####
+
+FROM alpine:3.11 AS runner
+
+RUN apk add --no-cache nodejs
+
+WORKDIR /webserver
+COPY --from=builder /webserver /webserver
+
+# Move the word list to where abbreviation_gen expects it
+RUN mkdir -p /usr/share/dict && \
+ mv /webserver/words /usr/share/dict/words
ENTRYPOINT ["./webserver.js"]