django - Docker build diverges between local and cloud
问题描述
I'm running a dockerized django admin and locally it runs perfectly when I specify the workdir as /app But when I try to do it on the circleci it just fails to find the dockerfile. If then I specify the workdir as /app/backend it finds it correctly.
I thought of having a workdir when user runs it locally and when it runs on the cloud but there are other troubles with path imports on the later.
project
│
└───.circleci
│ │ config.yml
│
└───backend
│ │ Dockerfile
│ │ manage.py
│ │ requirements.txt
│
└───frontend
FROM python:3.6.4
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
RUN apt-get update
RUN apt-get -y install apache2 \
&& apt-get -y install apache2-dev
RUN pip install mod_wsgi
RUN pip install cython==0.29.10 numpy==1.16.4
RUN pip install -r requirements.txt
RUN mod_wsgi-express module-config > /etc/apache2/mods-available/wsgi.load
RUN a2enmod wsgi
RUN cat config/apache-server.conf >> /etc/apache2/apache2.conf
RUN echo yes | python manage.py collectstatic
VOLUME ["/var/log/apache2"]
EXPOSE 80 443
CMD ["apache2ctl", "-D", "FOREGROUND"]
Anyone knows why this happens, or how could I fix it?
解决方案
推荐阅读
- laravel - Laravel 返回错误后如何显示 Bootstrap 通知/toast (MDBootstrap)
- hibernate - 如何修复“:意外元素(”URI:“http://www.hibernate.org/xsd/orm/cfg”,本地“休眠配置”)
- ios - 在具有最大高度的动态高度的 UITableViewCell 中添加 UITextView
- angular - IONIC 4空项目android apk文件大小大
- python - 一起循环多个生成器
- c++ - 为什么我在这里得到垃圾(不需要的)输出?
- php - 从 Json API 端点获取数据并将数据保存在数组中。基本上从从 API 回调接收到的 Json 数据创建变量
- angular - 如何修复 net::ERR_ABORTED 404(未找到)
- javascript - Jquery 在 if 语句中找不到“this”
- python - df 对具有相同日期的行进行分组