6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-12 06:07:56 +00:00

Reduce openedx image size with static asset deduplication

This is inspired from FUN's openedx-docker project: static files are
de-duplicated with rdfind to reduce the uncompressed image size by
320Mb.
This commit is contained in:
Régis Behmo 2020-09-01 19:14:30 +02:00
parent 190f35d4d0
commit 30cd29e7ef
2 changed files with 8 additions and 2 deletions

View File

@ -2,6 +2,10 @@
Note: Breaking changes between versions are indicated by "💥". Note: Breaking changes between versions are indicated by "💥".
## Unreleased
- [Improvement] Reduce "openedx" Docker image size with static asset de-duplication
## v10.2.1 (2020-08-27) ## v10.2.1 (2020-08-27)
- [Bugfix] Upgrade all services to open-release/juniper.3 - [Bugfix] Upgrade all services to open-release/juniper.3

View File

@ -111,7 +111,7 @@ RUN npm install --verbose --registry=$NPM_REGISTRY
FROM minimal as production FROM minimal as production
# Install system requirements # Install system requirements
RUN apt install -y gettext gfortran graphviz graphviz-dev libffi-dev libfreetype6-dev libgeos-dev libjpeg8-dev liblapack-dev libmysqlclient-dev libpng12-dev libsqlite3-dev libxmlsec1-dev lynx ntp pkg-config \ RUN apt install -y gettext gfortran graphviz graphviz-dev libffi-dev libfreetype6-dev libgeos-dev libjpeg8-dev liblapack-dev libmysqlclient-dev libpng12-dev libsqlite3-dev libxmlsec1-dev lynx ntp pkg-config rdfind \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
COPY --from=dockerize /usr/local/bin/dockerize /usr/local/bin/dockerize COPY --from=dockerize /usr/local/bin/dockerize /usr/local/bin/dockerize
@ -177,7 +177,9 @@ RUN openedx-assets xmodule \
&& openedx-assets common && openedx-assets common
COPY ./themes/ /openedx/themes/ COPY ./themes/ /openedx/themes/
RUN openedx-assets themes \ RUN openedx-assets themes \
&& openedx-assets collect --settings=tutor.assets && openedx-assets collect --settings=tutor.assets \
# De-duplicate static assets with symlinks
&& rdfind -makesymlinks true -followsymlinks true /openedx/staticfiles/
# Create a data directory, which might be used (or not) # Create a data directory, which might be used (or not)
RUN mkdir /openedx/data RUN mkdir /openedx/data