diff --git a/.dockerignore b/.dockerignore index 04925ce..2af1e3c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,7 @@ * !/maloja -!Dockerfile +!Containerfile +!/requirements_pre.txt !/requirements.txt !/pyproject.toml !/README.md diff --git a/Containerfile b/Containerfile index e30dfa4..22b0b72 100644 --- a/Containerfile +++ b/Containerfile @@ -15,6 +15,16 @@ RUN \ apk add py3-pip && \ pip install wheel +# these are more static than the real requirements, which means caching +COPY ./requirements_pre.txt ./requirements_pre.txt + +RUN \ + apk add --no-cache --virtual .build-deps gcc g++ python3-dev libxml2-dev libxslt-dev libffi-dev libc-dev py3-pip linux-headers && \ + pip install --no-cache-dir -r requirements_pre.txt && \ + apk del .build-deps + + +# less likely to be cached COPY ./requirements.txt ./requirements.txt RUN \ diff --git a/dev/templates/Containerfile.jinja b/dev/templates/Containerfile.jinja index 155c6a8..e180abd 100644 --- a/dev/templates/Containerfile.jinja +++ b/dev/templates/Containerfile.jinja @@ -15,6 +15,16 @@ RUN \ apk add py3-pip && \ pip install wheel +# these are more static than the real requirements, which means caching +COPY ./requirements_pre.txt ./requirements_pre.txt + +RUN \ + apk add --no-cache --virtual .build-deps {{ tool.osreqs.alpine.build | join(' ') }} && \ + pip install --no-cache-dir -r requirements_pre.txt && \ + apk del .build-deps + + +# less likely to be cached COPY ./requirements.txt ./requirements.txt RUN \ diff --git a/requirements_pre.txt b/requirements_pre.txt new file mode 100644 index 0000000..c4c0dbe --- /dev/null +++ b/requirements_pre.txt @@ -0,0 +1,3 @@ +# this is a more static file that enables container images to be cached +# it should contain packages that take long to build and don't change frequently +lxml