COPY 命令在多阶段 Dockerfile 中无法按预期工作
COPY command not working as expected in multistage Dockerfile
第 1 阶段:
FROM node:10.23.0-alpine as react
WORKDIR /app
RUN npm run build
第 2 阶段:
FROM python:3.6-alpine3.7 AS release
# Create app directory
WORKDIR /app
# In the below line only the contents of the build folder is been copied and not the folder itself
COPY --from=react /app/build ./
根据上面的 Dockerfile,我正在尝试将构建文件夹从阶段 1 复制到阶段 2 中的 python 图像。只复制了构建文件夹的内容,而不是完整的文件夹
创建一个要复制的文件夹
COPY --from=react /app/build ./new_directory
第 1 阶段:
FROM node:10.23.0-alpine as react
WORKDIR /app
RUN npm run build
第 2 阶段:
FROM python:3.6-alpine3.7 AS release
# Create app directory
WORKDIR /app
# In the below line only the contents of the build folder is been copied and not the folder itself
COPY --from=react /app/build ./
根据上面的 Dockerfile,我正在尝试将构建文件夹从阶段 1 复制到阶段 2 中的 python 图像。只复制了构建文件夹的内容,而不是完整的文件夹
创建一个要复制的文件夹
COPY --from=react /app/build ./new_directory