overhangio / tutor

The Docker-based Open edX distribution designed for peace of mind
https://docs.tutor.overhang.io/
GNU Affero General Public License v3.0
909 stars 433 forks source link

Avoid rebuilding image to add new XBlocks? #9

Closed natea closed 6 years ago

natea commented 6 years ago

I wanted to test out a new XBlock, so I added a new file to the requirements/edx directory: https://github.com/natea/edx-platform/blob/natea/testing/requirements/edx/appsembler.txt

And changed these lines in the Dockerfile:

## Checkout edx-platform code
RUN git clone https://github.com/natea/edx-platform.git --branch natea/testing --depth 1 .

# Install python requirements
RUN pip install -r requirements/edx/pre.txt
...
RUN pip install -r requirements/edx/appsembler.txt

When I run make build, it sees that it has already checked out edx-platform and it doesn't pip install the new requirements file.

I have to run docker-compose build --no-cache lms cms in order for force a rebuild of the entire image. Is there an easier / faster way to do this?

regisb commented 6 years ago

Hmmm... There is no easy fix that will allow you both to frequently update the edx-platform code and quickly re-build the image. I suggest you tag the git revisions from the natea/testing branch (git tag mytag) and fetch the corresponding tags by replacing --branch natea/testing with --branch mytag. (the --branch option supports tags, too)

This will allow you to rebuild the image with the appropriate revision, but rebuilding the image will take long every time you change the repo revision.

Alternatively, if the new requirements do not impact the build, you can add the following instruction at the bottom of the Dockerfile:

RUN git fetch origin && git checkout mytag && pip install -r requirements/appsembler.txt

Thus, all previous instructions will be cached.

frob commented 5 years ago

I will be testing this method shortly (but right now I am in the middle of rebuilding my images).

Could we not just use docker-compose run? https://docs.docker.com/compose/reference/run/

regisb commented 5 years ago

Well you're right that you could re-install the xblock every time the image is run, but that is quite inconvenient.

frob commented 5 years ago

I was thinking of the OP

I wanted to test out a new XBlock

If anything is changed it really should be in the image.