Skip to content

Commit

Permalink
only download language pack during image build, install has to be don…
Browse files Browse the repository at this point in the history
…e later so as not to confuse the bitnami installer with existing files and dirs
  • Loading branch information
JannikBadenhop committed Nov 11, 2024
1 parent bd53a0d commit 6e33b31
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 4 additions & 5 deletions moodle/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ RUN curl -L https://github.com/tmuras/moosh/archive/refs/tags/1.21.tar.gz -o moo
ln -s /moosh/moosh.php /usr/local/bin/moosh

RUN /downloadMoodle.sh
RUN mkdir /bitnami/moodledata/lang && \
MAJOR_MINOR=$(echo "$MOODLE_VERSION" | cut -d. -f1,2) && \
curl -L https://download.moodle.org/download.php/direct/langpack/4.1/de.zip --output de.zip && \
unzip de.zip -d /bitnami/moodledata/lang

# Install plugins to the image
RUN mkdir /plugins && /downloadPlugins.sh
Expand All @@ -46,7 +42,6 @@ RUN echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen && locale-gen
COPY --from=build "/moodle-${MOODLE_VERSION}.tgz" "/moodle-${MOODLE_VERSION}.tgz"
COPY --from=build /moosh /moosh
COPY --from=build /plugins /plugins
COPY --from=build /bitnami/moodledata/lang /bitnami/moodledata/lang

COPY scripts/init/entrypoint.sh /scripts/entrypoint.sh
COPY scripts/init/updateCheck.sh /scripts/updateCheck.sh
Expand All @@ -66,6 +61,10 @@ RUN apt-get update && apt-get upgrade -y && \
# Install redis-php which is required for moodle to use redis
RUN /phpRedisInstall.sh

RUN MAJOR_MINOR=$(echo "$MOODLE_VERSION" | cut -d. -f1,2) && \
curl -L https://download.moodle.org/download.php/direct/langpack/${MAJOR_MINOR}/de.zip --output /tmp/de.zip


RUN chown 1001:root -R /opt/bitnami
RUN chown 1001:root -R /plugins

Expand Down
8 changes: 8 additions & 0 deletions moodle/scripts/init/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ upgrade_if_pending
MODULE=dbp info "Replacing config files with ours"
/bin/cp -p /moodleconfig/config.php /bitnami/moodle/config.php
/bin/cp /moodleconfig/php.ini /opt/bitnami/php/etc/conf.d/php.ini

if [ -f "/tmp/de.zip" ]; then \
MODULE=dbp warn "Installing german language pack"
mkdir -p /bitnami/moodledata/lang
unzip -q /tmp/de.zip -d /bitnami/moodledata/lang
rm -f /tmp/de.zip
fi

upgrade_if_pending

if [[ ! -f "$update_failed_path" ]] && [[ ! -f "$plugin_state_failed_path" ]]; then
Expand Down

0 comments on commit 6e33b31

Please sign in to comment.