diff options
author | 2021-02-07 12:43:41 +0100 | |
---|---|---|
committer | 2021-02-07 12:43:41 +0100 | |
commit | 7329a7fd852082f0216b4f67f1912eaa601981fc (patch) | |
tree | 1209c90933e646dbbfa1bbc706eb6ec48d5d5050 /docker/Dockerfile | |
parent | Modifying Dockerfile so that it can use the current application code to build... (diff) | |
download | ferdium-server-7329a7fd852082f0216b4f67f1912eaa601981fc.tar.gz ferdium-server-7329a7fd852082f0216b4f67f1912eaa601981fc.tar.zst ferdium-server-7329a7fd852082f0216b4f67f1912eaa601981fc.zip |
Add new configuration for docker with small script to generate or use APP_KEY. docker-compose was adjusted to use DATA_DIR.
Diffstat (limited to 'docker/Dockerfile')
-rw-r--r-- | docker/Dockerfile | 109 |
1 files changed, 20 insertions, 89 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile index a561509..799bb0b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile | |||
@@ -1,96 +1,27 @@ | |||
1 | FROM lsiobase/alpine:3.11 | 1 | FROM node:lts-alpine as build |
2 | 2 | ||
3 | # version labels | 3 | WORKDIR /server-build |
4 | ARG BUILD_DATE | 4 | |
5 | LABEL build_version="Ferdi-server-docker Build-date:- ${BUILD_DATE}" | 5 | RUN ["apk", "add", "--no-cache", "python", "make", "gcc", "g++", "libc-dev", "sqlite-dev"] |
6 | |||
7 | COPY . /server-build | ||
8 | |||
9 | RUN ["npm", "ci", "--production", "--build-from-source", "--sqlite=/usr/local"] | ||
10 | |||
11 | FROM node:lts-alpine | ||
12 | |||
13 | WORKDIR /app | ||
6 | LABEL maintainer="xthursdayx" | 14 | LABEL maintainer="xthursdayx" |
7 | 15 | ||
8 | ARG FERDI_RELEASE | 16 | ENV HOST=0.0.0.0 PORT=3333 |
9 | ENV NODE_VERSION=10.16.3 | ||
10 | ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2 | ||
11 | 17 | ||
12 | # install packages | 18 | RUN ["apk", "add", "--no-cache", "sqlite-libs", "curl"] |
13 | RUN \ | ||
14 | echo "**** installing build packages ****" && \ | ||
15 | apk add --no-cache \ | ||
16 | libcap \ | ||
17 | libstdc++ \ | ||
18 | nano && \ | ||
19 | apk add --no-cache --virtual .build-deps \ | ||
20 | binutils-gold \ | ||
21 | curl \ | ||
22 | gnupg \ | ||
23 | gcc \ | ||
24 | g++ \ | ||
25 | linux-headers \ | ||
26 | make \ | ||
27 | memcached \ | ||
28 | python && \ | ||
29 | echo "**** downloading keys ****" && \ | ||
30 | # gpg keys listed at https://github.com/nodejs/node#release-keys | ||
31 | for key in \ | ||
32 | 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ | ||
33 | FD3A5288F042B6850C66B31F09FE44734EB7990E \ | ||
34 | 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ | ||
35 | DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ | ||
36 | C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ | ||
37 | B9AE9905FFD7803F25714661B63B535A4C206CA9 \ | ||
38 | 77984A986EBC2AA786BC0F66B01FBB92821C587A \ | ||
39 | 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ | ||
40 | 4ED778F539E3634C779C87C6D7062848A1AB005C \ | ||
41 | A48C2BEE680E841632CD4E44F07496B3EB3C1762 \ | ||
42 | B9E2F5981AA6E0CD28160D9FF13993A75599653C \ | ||
43 | ; do \ | ||
44 | gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ | ||
45 | gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ | ||
46 | gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \ | ||
47 | done && \ | ||
48 | echo "**** installing node ****" && \ | ||
49 | curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz" && \ | ||
50 | curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" && \ | ||
51 | gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc && \ | ||
52 | grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c - && \ | ||
53 | tar -xf "node-v$NODE_VERSION.tar.xz" && \ | ||
54 | cd "node-v$NODE_VERSION" && \ | ||
55 | ./configure --prefix=/usr && \ | ||
56 | make -j$(getconf _NPROCESSORS_ONLN) V= && \ | ||
57 | make install && \ | ||
58 | apk del .build-deps && \ | ||
59 | cd / && \ | ||
60 | rm -Rf "node-v$NODE_VERSION" && \ | ||
61 | rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt | ||
62 | 19 | ||
63 | COPY . /app | 20 | COPY --from=build /server-build /app |
64 | 21 | RUN ["touch", ".env"] | |
65 | RUN \ | 22 | RUN ["npm", "i", "-g", "@adonisjs/cli"] |
66 | apk add --no-cache --virtual .build-deps-ferdi \ | ||
67 | curl \ | ||
68 | gnupg \ | ||
69 | tar && \ | ||
70 | echo "**** installing npm ****" && \ | ||
71 | npm config set unsafe-perm true && \ | ||
72 | npm install -g npm@latest && \ | ||
73 | find /usr/lib/node_modules/npm -name test -o -name .bin -type d | xargs rm -rf && \ | ||
74 | echo "**** cleanup ****" && \ | ||
75 | apk del .build-deps-ferdi && \ | ||
76 | rm -rf \ | ||
77 | ${RM_DIRS} \ | ||
78 | /SHASUMS256.txt \ | ||
79 | /tmp/* \ | ||
80 | /var/cache/apk/* \ | ||
81 | /usr/share/man/* \ | ||
82 | /usr/share/doc \ | ||
83 | /root/.node-gyp \ | ||
84 | /root/.config \ | ||
85 | /usr/lib/node_modules/npm/man \ | ||
86 | /usr/lib/node_modules/npm/doc \ | ||
87 | /usr/lib/node_modules/npm/html \ | ||
88 | /usr/lib/node_modules/npm/scripts | ||
89 | |||
90 | COPY docker/root/ / | ||
91 | 23 | ||
92 | USER root | 24 | HEALTHCHECK --interval=5m --timeout=3s CMD curl -sSf http://localhost:${PORT}/health |
93 | 25 | ||
94 | # ports and volumes | 26 | COPY docker/entrypoint.sh /entrypoint.sh |
95 | EXPOSE 80 443 | 27 | CMD ["/entrypoint.sh"] \ No newline at end of file |
96 | VOLUME /app/database /app/recipes /config | ||