You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we have one big container with Python AND Node. We should switch this out to multi-part per @moz-astults recommendation.
To do this, we need to move django-gulp to be DEVmode only.
In the first container (node), we should install npm and run npm install and THEN run gulp to compile all the CSS. Copy over the compiled filed and then move on to the Python.
Note – @moz-astults made great progress down this path and we had to abandon it. See this commit for how it should work: 2429d53
The text was updated successfully, but these errors were encountered:
My read on multi-stage Dockerfiles suggests that the 2nd FROM python:3.7.9 directive starts a new container, so that python container doesn't have node, which collectstatic is trying to use. And that's why we get this error:
=> ERROR [stage-1 12/12] RUN python manage.py collectstatic --no-input -v 2 3.4s
------
> [stage-1 12/12] RUN python manage.py collectstatic --no-input -v 2:
#22 3.289 /usr/bin/env: 'node': No such file or directory
#22 3.290 CommandError: Command 'gulp build --cwd /app --production' returned non-zero exit status 127.
------
executor failed running [/bin/sh -c python manage.py collectstatic --no-input -v 2]: exit code: 1
The main issue is that django-gulp makes collectstatic also run gulp. So it tightly couples the python & node commands to each other. 😢 I think what we'd like is to use django-gulp for local and heroku dev, but NOT use django-gulp for stage + prod. For stage + prod, we should be able to:
FROM node:14 as gulp-image image, RUN npm install && gulp build
COPY --from=gulp-image /app/static/* ./app/static
FROM python:3.7.9 image, RUN python manage.py collectstatic
Currently we have one big container with Python AND Node. We should switch this out to multi-part per @moz-astults recommendation.
To do this, we need to move
django-gulp
to beDEV
mode only.In the first container (
node
), we should install npm and runnpm install
and THEN rungulp
to compile all the CSS. Copy over the compiled filed and then move on to the Python.Note – @moz-astults made great progress down this path and we had to abandon it. See this commit for how it should work: 2429d53
The text was updated successfully, but these errors were encountered: