Skip to content

Commit

Permalink
Add update recipes to ferdium server based on github repo (ferdium#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
SpecialAro committed May 13, 2022
1 parent 71344fe commit 0cb24b3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ docker
!docker/.env
node_modules
.husky

# Ignore recipes folder (it is pulled in the image by git)
recipes
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]
24 changes: 23 additions & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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

0 comments on commit 0cb24b3

Please sign in to comment.