问题描述
我想在Docker映像中包含从python manage.py collectstatic
生成的静态文件。
为此,我在Dockerfile
CMD python manage.py collectstatic --no-input
但是因为它在中间容器中运行命令,所以生成的静态文件不在STATIC_ROOT
目录中。我可以在构建日志中看到以下几行。
Step 13/14 : CMD python manage.py collectstatic --no-input
---> Running in 8ea5efada461
Removing intermediate container 8ea5efada461
---> 67aef71cc7b6
我想在图像中包含生成的静态文件。我应该怎么做才能做到这一点?
更新(解决方案)
我正在使用CMD,但我应该按照文档中的说明使用RUN命令执行此任务
The RUN instruction will execute any commands in a new layer on top of the current image and commit the results. The resulting committed image will be used for the next step in the Dockerfile.
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)