Docker hub autobuild在子目录中

问题描述 投票:1回答:1

我正在尝试使用以下文件夹结构从子目录'app'构建我的Django应用程序的图像。但是,在docker-hub上指定我的构建规则后,请执行以下操作:

  • 建立位置:app/Dockerfile
  • 建立背景:/

自动构建仍然无法找到requirements.txt

Image of my build rule on Docker hub

/
├── app/
│   ├── Dockerfile
│   ├── requirements.txt
│   └── (Django files...)
├── nginx/
│   ├── Dockerfile
│   └── (nginx files...)
└── docker-compose.yml

应用程序/ 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构建日志:

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

我已经尝试将所有文​​件从app/提取到另一个存储库,并且dockerhub成功构建了映像,没有错误。

如果有人有任何想法,将深表感谢!

docker dockerhub auto-build
1个回答
0
投票

试试这个:

  • 建立位置:Dockerfile
  • 建立背景:app
© www.soinside.com 2019 - 2024. All rights reserved.