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 "💥".
## Unreleased
- [Improvement] Reduce "openedx" Docker image size with static asset de-duplication
## v10.2.1 (2020-08-27)
- [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
# 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/*
COPY --from=dockerize /usr/local/bin/dockerize /usr/local/bin/dockerize
@ -177,7 +177,9 @@ RUN openedx-assets xmodule \
&& openedx-assets common
COPY ./themes/ /openedx/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)
RUN mkdir /openedx/data