diff options
author | André Oliveira <37463445+SpecialAro@users.noreply.github.com> | 2022-05-13 12:11:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-13 12:11:06 +0100 |
commit | 0cb24b3c34c02185b0799f8e9f3dbff48e8dede2 (patch) | |
tree | 85210af9dc566aec9fc93538a637e319ad2e3343 | |
parent | Upgrade 'node' (16.14 -> 16.15); Upgrade 'pnpm' (6 --> 7) (diff) | |
download | ferdium-server-0cb24b3c34c02185b0799f8e9f3dbff48e8dede2.tar.gz ferdium-server-0cb24b3c34c02185b0799f8e9f3dbff48e8dede2.tar.zst ferdium-server-0cb24b3c34c02185b0799f8e9f3dbff48e8dede2.zip |
Add update recipes to ferdium server based on github repo (#33)
-rw-r--r-- | .dockerignore | 3 | ||||
-rw-r--r-- | Dockerfile | 6 | ||||
-rwxr-xr-x | docker/entrypoint.sh | 24 |
3 files changed, 31 insertions, 2 deletions
diff --git a/.dockerignore b/.dockerignore index e97b248..84d3156 100644 --- a/.dockerignore +++ b/.dockerignore | |||
@@ -16,3 +16,6 @@ docker | |||
16 | !docker/.env | 16 | !docker/.env |
17 | node_modules | 17 | node_modules |
18 | .husky | 18 | .husky |
19 | |||
20 | # Ignore recipes folder (it is pulled in the image by git) | ||
21 | recipes | ||
@@ -21,6 +21,10 @@ LABEL maintainer="ferdium" | |||
21 | ENV HOST=0.0.0.0 PORT=3333 DATA_DIR="/data" | 21 | ENV HOST=0.0.0.0 PORT=3333 DATA_DIR="/data" |
22 | 22 | ||
23 | RUN apk add --no-cache sqlite-libs curl su-exec | 23 | RUN apk add --no-cache sqlite-libs curl su-exec |
24 | RUN apk add --no-cache python3 make g++ py3-pip git py3-pip | ||
25 | # The next command is needed for sqlite3 install command executed by node-gyp | ||
26 | RUN ln -s /usr/bin/python3 /usr/bin/python | ||
27 | |||
24 | 28 | ||
25 | COPY --from=build /server-build /app | 29 | COPY --from=build /server-build /app |
26 | RUN npm i -g @adonisjs/cli | 30 | RUN npm i -g @adonisjs/cli |
@@ -30,4 +34,4 @@ HEALTHCHECK --start-period=5s --interval=30s --retries=5 --timeout=3s CMD curl - | |||
30 | COPY docker/entrypoint.sh /entrypoint.sh | 34 | COPY docker/entrypoint.sh /entrypoint.sh |
31 | COPY docker/.env /app/.env | 35 | COPY docker/.env /app/.env |
32 | 36 | ||
33 | CMD ["/entrypoint.sh"] | 37 | ENTRYPOINT ["/entrypoint.sh"] |
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 51df4e3..a928f7e 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh | |||
@@ -16,6 +16,28 @@ cat << "EOL" | |||
16 | Brought to you by ferdium.org | 16 | Brought to you by ferdium.org |
17 | EOL | 17 | EOL |
18 | 18 | ||
19 | # Update recipes from official git repository | ||
20 | npm i -gf pnpm@7.0.1 | ||
21 | |||
22 | if [ ! -d "/app/recipes/.git" ]; # When we mount an existing volume (ferdium-recipes-vol:/app/recipes) if this is only /app/recipes it is always true | ||
23 | then | ||
24 | echo '**** Generating recipes for first run ****' | ||
25 | git clone --branch main https://github.com/ferdium/ferdium-recipes recipes | ||
26 | else | ||
27 | echo '**** Updating recipes ****' | ||
28 | chown -R root /app/recipes # Fixes ownership problem when doing git pull -r | ||
29 | cd recipes | ||
30 | git stash -u | ||
31 | git pull -r | ||
32 | git stash pop | ||
33 | cd .. | ||
34 | fi | ||
35 | |||
36 | cd recipes | ||
37 | pnpm i | ||
38 | pnpm package | ||
39 | cd .. | ||
40 | |||
19 | key_file="${DATA_DIR}/FERDIUM_APP_KEY.txt" | 41 | key_file="${DATA_DIR}/FERDIUM_APP_KEY.txt" |
20 | 42 | ||
21 | print_app_key_message() { | 43 | print_app_key_message() { |
@@ -41,6 +63,6 @@ export APP_KEY | |||
41 | 63 | ||
42 | node ace migration:run --force | 64 | node ace migration:run --force |
43 | 65 | ||
44 | chown -R "${PUID:-1000}":"${PGID:-1000}" "${DATA_DIR}" /app | 66 | chown -R "${PUID:-1000}":"${PGID:-1000}" "${DATA_DIR}" /app # This is the cause of the problem on line 29/32 |
45 | 67 | ||
46 | su-exec "${PUID:-1000}":"${PGID:-1000}" node server.js | 68 | su-exec "${PUID:-1000}":"${PGID:-1000}" node server.js |