首页 > 解决方案 > 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?

标签: djangodockerdockerfiledjango-admincircleci

解决方案


推荐阅读