From 0cb24b3c34c02185b0799f8e9f3dbff48e8dede2 Mon Sep 17 00:00:00 2001 From: André Oliveira <37463445+SpecialAro@users.noreply.github.com> Date: Fri, 13 May 2022 12:11:06 +0100 Subject: Add update recipes to ferdium server based on github repo (#33) --- .dockerignore | 3 +++ Dockerfile | 6 +++++- 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 !docker/.env node_modules .husky + +# Ignore recipes folder (it is pulled in the image by git) +recipes diff --git a/Dockerfile b/Dockerfile index 36a1cc9..bc1e840 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,10 @@ LABEL maintainer="ferdium" ENV HOST=0.0.0.0 PORT=3333 DATA_DIR="/data" RUN apk add --no-cache sqlite-libs curl su-exec +RUN apk add --no-cache python3 make g++ py3-pip git py3-pip +# The next command is needed for sqlite3 install command executed by node-gyp +RUN ln -s /usr/bin/python3 /usr/bin/python + COPY --from=build /server-build /app RUN npm i -g @adonisjs/cli @@ -30,4 +34,4 @@ HEALTHCHECK --start-period=5s --interval=30s --retries=5 --timeout=3s CMD curl - COPY docker/entrypoint.sh /entrypoint.sh COPY docker/.env /app/.env -CMD ["/entrypoint.sh"] +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" Brought to you by ferdium.org EOL +# Update recipes from official git repository +npm i -gf pnpm@7.0.1 + +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 +then + echo '**** Generating recipes for first run ****' + git clone --branch main https://github.com/ferdium/ferdium-recipes recipes +else + echo '**** Updating recipes ****' + chown -R root /app/recipes # Fixes ownership problem when doing git pull -r + cd recipes + git stash -u + git pull -r + git stash pop + cd .. +fi + +cd recipes +pnpm i +pnpm package +cd .. + key_file="${DATA_DIR}/FERDIUM_APP_KEY.txt" print_app_key_message() { @@ -41,6 +63,6 @@ export APP_KEY node ace migration:run --force -chown -R "${PUID:-1000}":"${PGID:-1000}" "${DATA_DIR}" /app +chown -R "${PUID:-1000}":"${PGID:-1000}" "${DATA_DIR}" /app # This is the cause of the problem on line 29/32 su-exec "${PUID:-1000}":"${PGID:-1000}" node server.js -- cgit v1.2.3-54-g00ecf