Skip to content

Commit

Permalink
feat: cache edx-platform checkout in image build
Browse files Browse the repository at this point in the history
Similar to what we need with the MFE image, we leverage Docker's ADD
directive to implement caching of the edx-platform git checkout step.

See: overhangio/tutor-mfe#163
https://docs.docker.com/reference/dockerfile/#add
  • Loading branch information
regisb committed Jun 10, 2024
1 parent 41330ce commit fc29241
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- 💥[Improvement] Ensure that the edx-platform repository git checkout is cached by Docker during image build. This means that the cache will automatically be cleared any time there is an upstream change. Thus, it is no longer necessary to run `tutor images build --no-cache` just to fetch the latest edx-platform changes. For this to work, any GitHub repository referenced by `EDX_PLATFORM_REPOSITORY` needs to end with ".git". Make sure that this is the case if you have modified the value of this setting in the past. (by @regisb)
4 changes: 2 additions & 2 deletions tutor/templates/build/openedx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ RUN $PYENV_ROOT/versions/$PYTHON_VERSION/bin/python -m venv /openedx/venv
FROM minimal as code
ARG EDX_PLATFORM_REPOSITORY={{ EDX_PLATFORM_REPOSITORY }}
ARG EDX_PLATFORM_VERSION={{ EDX_PLATFORM_VERSION }}
RUN mkdir -p /openedx/edx-platform && \
git clone $EDX_PLATFORM_REPOSITORY --branch $EDX_PLATFORM_VERSION --depth 1 /openedx/edx-platform
RUN mkdir -p /openedx/edx-platform
WORKDIR /openedx/edx-platform
ADD --keep-git-dir=true $EDX_PLATFORM_REPOSITORY#$EDX_PLATFORM_VERSION .

# Identify tutor user to apply patches using git
RUN git config --global user.email "[email protected]" \
Expand Down

0 comments on commit fc29241

Please sign in to comment.