Docker 集线器在子目录中自动构建
Docker hub autobuild inside a subdirectory
我正在尝试从具有以下文件夹结构的子目录 '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
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-集线器构建日志:
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 成功构建了映像,没有出现错误。
如果有人有任何想法,将不胜感激!
试试这个:
- 建造地点:
Dockerfile
- 构建上下文:
app
我正在尝试从具有以下文件夹结构的子目录 '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
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-集线器构建日志:
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 成功构建了映像,没有出现错误。
如果有人有任何想法,将不胜感激!
试试这个:
- 建造地点:
Dockerfile
- 构建上下文:
app