I'm trying to build an image of my Django app from the subdirectory 'app' with the following folder structure. However, after specifying my build rules on docker-hub the following:
app/Dockerfile
/
The automated build still failed to locate requirements.txt
Image of my build rule on Docker hub
/
├── app/
│ ├── Dockerfile
│ ├── requirements.txt
│ └── (Django files...)
├── nginx/
│ ├── Dockerfile
│ └── (nginx files...)
└── docker-compose.yml
app/Dockerfile:
FROM python:3.7
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN pip install --upgrade pip
RUN mkdir /app
WORKDIR /app
COPY . /app/
RUN pip install -r requirements.txt
# copy entrypoint.sh
COPY ./entrypoint.sh /app/entrypoint.sh
# run entrypoint.sh
ENTRYPOINT ["/app/entrypoint.sh"]
Docker-hub build logs:
Building in Docker Cloud's infrastructure...
Cloning into '.'...
Warning: Permanently added the RSA host key for IP address '18.205.93.0' to the list of known hosts.
Reset branch 'master'
Your branch is up-to-date with 'origin/master'.
KernelVersion: 4.4.0-1060-aws
Components: [{u'Version': u'18.03.1-ee-3', u'Name': u'Engine', u'Details': {u'KernelVersion': u'4.4.0-1060-aws', u'Os': u'linux', u'BuildTime': u'2018-08-30T18:42:30.000000000+00:00', u'ApiVersion': u'1.37', u'MinAPIVersion': u'1.12', u'GitCommit': u'b9a5c95', u'Arch': u'amd64', u'Experimental': u'false', u'GoVersion': u'go1.10.2'}}]
Arch: amd64
BuildTime: 2018-08-30T18:42:30.000000000+00:00
ApiVersion: 1.37
Platform: {u'Name': u''}
Version: 18.03.1-ee-3
MinAPIVersion: 1.12
GitCommit: b9a5c95
Os: linux
GoVersion: go1.10.2
Starting build of index.docker.io/wbivan/app:latest...
Step 1/10 : FROM python:3.7
---> 32260605cf7a
Step 2/10 : ENV PYTHONDONTWRITEBYTECODE 1
---> Running in 36328642fa7b
Removing intermediate container 36328642fa7b
---> 75ad30f28d3d
Step 3/10 : ENV PYTHONUNBUFFERED 1
---> Running in a738da33e03d
Removing intermediate container a738da33e03d
---> 1c43f8656572
Step 4/10 : RUN pip install --upgrade pip
---> Running in 3b7a7e530620
Requirement already up-to-date: pip in /usr/local/lib/python3.7/site-packages (19.0.3)
Removing intermediate container 3b7a7e530620
---> 8666c1c53e59
Step 5/10 : RUN mkdir /app
---> Running in 7006d126066b
Removing intermediate container 7006d126066b
---> 4561b40413c6
Step 6/10 : WORKDIR /app
Removing intermediate container 501eeeffa78c
---> a6d0e450cbfa
Step 7/10 : COPY . /app/
---> 3b07934d2804
Step 8/10 : RUN pip install -r requirements.txt
---> Running in 15878101bd36
Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
Removing intermediate container 15878101bd36
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
I've tried extracting all the files from app/
to another repository and dockerhub successfully built the image with no error.
If anyone has any idea that would be deeply appreciated!
Try this:
Dockerfile
app
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With