- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个多阶段Dockerfile
,它将某些部分从第一张图片复制到第二张图片,但此行始终失败
COPY --from=react-builder /app/build /var/www
Step 17/22 : COPY --from=react-builder /app/build /var/www
COPY failed: stat /mnt/data/docker/overlay2/901e2feb2323e7fc6d9de0f3e64e84d16d1e935e198bf19f15021af0eb6134d6/merged/app/build: no such file or directory
Dockerfile
FROM node:10-slim AS react-builder
ARG REACT_APP_ENV
ENV REACT_APP_ENV $REACT_APP_ENV
WORKDIR app
COPY . .
RUN cat /app/.env | grep = | sort | sed -e 's|REACT_APP_\([a-zA-Z_]*\)=\(.*\)|REACT_APP_\1=NGINX_REPLACE_\1|' > /app/.env.local
RUN npm config set registry=https://npm.company.com
RUN npm config set "strict-ssl" false
RUN npm install
RUN npm build
FROM nginx:1.15
COPY nginx.conf.template /etc/nginx/conf.d/nginx.conf.template
COPY gcp-deploy/htpasswd /etc/nginx/htpasswd
COPY --from=react-builder /app/.env.local /etc/nginx/conf.d/
RUN NGINX_SUB_FILTER=$(cat /etc/nginx/conf.d/.env.local | grep '=' | sort | sed -e 's/REACT_APP_\([a-zA-Z_]*\)=\(.*\)/sub_filter\ \"NGINX_REPLACE_\1\" \"$\{\1\}\";/') && cat /etc/nginx/conf.d/nginx.conf.template | sed -e "s|LOCATION_SUB_FILTER|$(echo $NGINX_SUB_FILTER)|" | sed -u 's|}";\ |}";\n\t\t|g' > /etc/nginx/conf.d/default.conf.template
COPY --from=react-builder /app/build /var/www
# This is a hack around the envsubst nginx config. Because we have `$uri` set
# up, it would replace this as well. Now we just reset it to its original value.
ENV uri \$uri
# Default config
ENV REST_URI " https://whatever.wherever.com/"
ENV PORT 80
ENV SERVER_NAME _
CMD ["sh", "-c", "envsubst < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"]
docker build .
可以轻松构建镜像
COPY --from
语句,构建始终会失败。还有第二个
COPY --from
命令始终通过。如果我切换顺序,我仍然会遇到相同的错误:
Step 17/22 : COPY --from=react-builder /app/build /var/www
COPY failed: stat /mnt/data/docker/overlay2/901e2feb2323e7fc6d9de0f3e64e84d16d1e935e198bf19f15021af0eb6134d6/merged/app/build: no such file or directory
docker version
的输出:
Client: Docker Engine - Community
Version: 19.03.5
API version: 1.39 (downgraded from 1.40)
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:25:41 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:19:08 2018
OS/Arch: linux/amd64
Experimental: false
docker info
的输出:
Client:
Debug Mode: false
Server:
Containers: 17
Running: 1
Paused: 0
Stopped: 16
Images: 374
Server Version: 18.09.0
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-1062.9.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.701GiB
Name: devs0211
ID: 25FQ:7G3D:T46W:4DTJ:VV4A:V7JG:DZ53:C2E4:O7JN:WUP6:XWPA:3FX4
Docker Root Dir: /mnt/data/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://docker.company.com/
Live Restore Enabled: true
Product License: Community Engine
ls -ls /app
$ docker build . --no-cache
[sudo] password for sc146082:
Your password will expire in 4 day(s).
Sending build context to Docker daemon 3.561MB
Step 1/23 : FROM node:10-slim as react-builder
---> 92eff963766f
Step 2/23 : ARG REACT_APP_ENV
---> Running in 13e997164e2c
Removing intermediate container 13e997164e2c
---> 8edcfa0931a8
Step 3/23 : ENV REACT_APP_ENV $REACT_APP_ENV
---> Running in 17fa11f08e3e
Removing intermediate container 17fa11f08e3e
---> a906714bef73
Step 4/23 : WORKDIR /app
---> Running in cbc94fc1faa8
Removing intermediate container cbc94fc1faa8
---> 10eaff3f4774
Step 5/23 : COPY . .
---> 567cfa8797d9
Step 6/23 : RUN cat /app/.env | grep = | sort | sed -e 's|REACT_APP_\([a-zA-Z_]*\)=\(.*\)|REACT_APP_\1=NGINX_REPLACE_\1|' > /app/.env.local
---> Running in c28d9688f19e
Removing intermediate container c28d9688f19e
---> 65dd918e5162
Step 7/23 : RUN npm config set registry=https://npm.company.com
---> Running in f83b8b73b4e8
Removing intermediate container f83b8b73b4e8
---> d36d51e3cabb
Step 8/23 : RUN npm config set "strict-ssl" false
---> Running in 1f65e71e350b
Removing intermediate container 1f65e71e350b
---> d297ff074f44
Step 9/23 : RUN npm install
---> Running in 09a445362f73
....
added 1696 packages from 978 contributors in 42.078s
55 packages are looking for funding
run `npm fund` for details
Removing intermediate container 09a445362f73
---> c30a48bda924
Step 10/23 : RUN npm build
---> Running in be3f6a0a64ea
npm WARN build `npm build` called with no arguments. Did you mean to `npm run-script build`?
Removing intermediate container be3f6a0a64ea
---> 14a5a88aeeb1
Step 11/23 : RUN pwd
---> Running in 1b7603116844
/app
Removing intermediate container 1b7603116844
---> 0579c1f467a8
Step 12/23 : RUN ls -ls /app
---> Running in fd4479923203
total 1240
4 -rw-r--r--. 1 root root 1406 Feb 5 11:37 Dockerfile
4 -rw-r--r--. 1 root root 504 Feb 4 14:10 Jenkinsfile
4 -rw-r--r--. 1 root root 1057 Feb 4 14:09 README.md
0 drwxr-xr-x. 2 root root 83 Feb 4 14:09 gcp-deploy
4 -rw-r--r--. 1 root root 827 Feb 4 14:09 nginx.conf.template
60 drwxr-xr-x. 1150 root root 36864 Feb 5 11:37 node_modules
628 -rw-r--r--. 1 root root 639799 Feb 5 11:37 package-lock.json
4 -rw-r--r--. 1 root root 2821 Feb 4 14:09 package.json
12 -rw-r--r--. 1 root root 9106 Feb 4 14:18 pom.xml
0 drwxr-xr-x. 2 root root 64 Feb 4 14:09 public
4 -rw-r--r--. 1 root root 591 Feb 4 14:09 sonar-project.properties
4 drwxr-xr-x. 15 root root 4096 Feb 4 14:09 src
0 drwxr-xr-x. 2 root root 28 Feb 4 14:10 target
4 -rw-r--r--. 1 root root 486 Feb 4 14:09 tsconfig.json
508 -rw-r--r--. 1 root root 517508 Feb 4 14:09 yarn.lock
Removing intermediate container fd4479923203
---> e3329a5200cd
Step 13/23 : FROM nginx:1.15
---> 53f3fd8007f7
Step 14/23 : COPY nginx.conf.template /etc/nginx/conf.d/nginx.conf.template
---> c6ddc33a47e7
Step 15/23 : COPY gcp-deploy/htpasswd /etc/nginx/htpasswd
---> db3d7c99cea0
Step 16/23 : COPY --from=react-builder /app/.env.local /etc/nginx/conf.d/
---> 973f6987ab00
Step 17/23 : RUN NGINX_SUB_FILTER=$(cat /etc/nginx/conf.d/.env.local | grep '=' | sort | sed -e 's/REACT_APP_\([a-zA-Z_]*\)=\(.*\)/sub_filter\ \"NGINX_REPLACE_\1\" \"$\{\1\}\";/') && cat /etc/nginx/conf.d/nginx.conf.template | sed -e "s|LOCATION_SUB_FILTER|$(echo $NGINX_SUB_FILTER)|" | sed -u 's|}";\ |}";\n\t\t|g' > /etc/nginx/conf.d/default.conf.template
---> Running in a1eb5fdc7a02
Removing intermediate container a1eb5fdc7a02
---> ee3041f221df
Step 18/23 : COPY --from=react-builder /app/build /var/www
COPY failed: stat /mnt/data/docker/overlay2/7a85db99ff921b8588b566624634cc64c864f0e7db46c6540d09517662f7335a/merged/app/build: no such file or directory
/mnt/data/docker/overlay2/7a85db99ff921b8588b566624634cc64c864f0e7db46c6540d09517662f7335a
不存在
最佳答案
该错误很明显,说明/app/build
层中不存在路径react-builder
。
解决此问题的方法是将WORKDIR app
更新为WORKDIR /app
,如下所示:
FROM node:10-slim AS react-builder
ARG REACT_APP_ENV
ENV REACT_APP_ENV $REACT_APP_ENV
WORKDIR /app
COPY . .
WORKDIR app
与
WORKDIR /app
不同,因此当您执行
RUN npm build
时,生成的
build
文件夹将不会保存在预期的
/app/build
中,因此会出现错误。
关于docker - 来自多阶段Dockerfile的`npm build`和`COPY --from`失败,并且`COPY失败:stat/mnt/data/docker/overlay2/xxxxx/merged/app/build,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60072107/
我有一个想法:(可能太完整了) 我想知道是否可以 substring(1) 然后使用 .toUpperCase()字符串 然后使用 getLength() 获取长度.toLowerCase() 字符串
当我单击 map Activity 上的后退按钮时,应用程序崩溃。添加 moveTaskToBack(true);在 onBackPressed() 中不起作用。以下是日志猫: ---------崩溃
我尝试创建它,但它似乎无法正常工作 (/^ [A-Z]\d{5} \- [A-Z]\d{5} \- [A-Z]\d{3} \- [A-Z]\d{2} $/)) 最佳答案 [A-Z]\d{5} 表示:从
你好我有一个主表 BASECOMPANYDATA,其中 BaseCompanyDataID 作为 PK。这是继承自2 个其他表 CUSTOMERS & PRODUCTCOMPANIES。现在我有了 C
这个问题已经有答案了: Get the data received in a Flask request (24 个回答) 已关闭去年。 flask.request.form["xxx"] 之间有什么
我试图在这里运行代码 -- http://code.google.com/p/android-market-api/wiki/HowDownloadApps--,并将此代码放在 Tester.java
我有两个格式为 XXXX.csv.gz_1_2.tar 和 XXXX.csv.gz_2_2.tar 的文件,我的目标是合并这些文件以便能够按顺序解压缩完整文件获取 csv 文件。 你能帮帮我吗? 我尝
这是我每次运行应用程序时的错误: E/AndroidRuntime: FATAL EXCEPTION: main java.lang.RuntimeException: Unable to i
在 Azure 网站上进行身份验证时,我遇到了回复 URL 的问题。正常登录时一切正常,但使用其他页面登录时会生成“回复 URL”错误。 例如,使用“https://xxxxx.azurewebsit
您好,我正在通过 WSDL 将 Java Web 服务加载到 Delphi 7。当我从 Delphi 调用 Web 服务时,出现以下错误。我被困在这里没有任何线索。 'Unmarshalling Er
关闭。这个问题需要details or clarity .它目前不接受答案。 想改进这个问题吗? 通过 editing this post 添加细节并澄清问题. 关闭 8 年前。 Improve t
我声明一个数据 让数据 = {} 然后我用promise调用webservice getUserData().then((res)=>{ this.setState({ data :
所以我要加入 TAF(集群故障转移)处理到一些数据库代码中,最后我会得到类似的代码块,如下所示: try: ... some database code...
当尝试重新设计合并排序程序时,我在函数中实现了 match with 语句。 let rec merge (array : int[]) (chunkA : int[]) (chunkB : int[
为什么这两种情况下PuTTY中tmux的分割线显示不同(xxxxx,qqqqqq)?如果我没有设置 PuTTY 任何东西(默认“使用字体编码”), Pane 的分割线显示如下: 但是不能正确显示中文单
我想用“XXXX”替换特定的字符串值。问题是模式非常动态,它在输入数据中没有固定模式。 我的输入数据 https://internetbanking.abc.co.uk/personal/logon/
这是我的代码: 但是我得到了一个黑色的边框。当我插入“Red”而不是 #-code 时
在windows 2003下,在运行web应用程序的时候出现一下错误: 服务器无法处理请求,-->对路径“C:/temp/mytest.txt”的访问拒绝 说明: 执行当前
我有一个工作流应用程序,当我尝试使用 ExternalDataExchangeService 调用事件时会引发错误。 在状态持久性存储中找不到 ID 为“866568ab-ca1b-4404-a2f1
我在设备中运行时收到此错误,请确实需要全面的帮助来解决此问题; Couldn't register com.XXXXX.deviceapp with the bootstrap server. Err
我是一名优秀的程序员,十分优秀!