Open timmc-edx opened 1 year ago
@timmc-edx:
I think the main use for a shared Docker image would be getting the right version of Python, yeah. That might be a separate PR, but it looks like we could add something like this to the Makefile:
SHELL := docker run --rm -v .:/edx/dev -w /edx/dev IMAGE_REF /bin/bash -c
with an image based on a Dockerfile that looks something like this:
FROM ubuntu:focal as minimal-system
RUN useradd -m --shell /bin/false app
WORKDIR /edx/dev
RUN chown app:app /edx/dev
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get -y dist-upgrade && \
apt-get -y install --no-install-recommends \
# Base Python system
python3.8 \
python3.8-venv
USER app
Seems like it works based on some local testing -- make requirements
runs on the host, but all of the actual commands run in the container. It could be made switchable so that the container is not required.
This allows a developer to run
make test
or other targets without having to manually set up a virtualenv or install requirements. The virtualenv is set up for them as a hidden subdirectory and requirements are automatically installed as needed.The goal here is larger: The new base.mk would be pulled in via git subtree from some centralized repository. Over time, this standardized base Makefile would grow and the Makefiles in regular repositories would shrink. By centralizing Makefile logic, we would gain the following: