我试图为我的Gatsby应用程序构建我的 Docker 映像。每当我运行命令docker build . -t gatsbyapp时,它都会给我一个错误:
docker build . -t gatsbyapp
failed to solve with frontend dockerfile.v0: failed to build LLB: failed to compute cache key: "/.env" not found: not found
同时我的 Dockerfile 如下所示:
FROM node:13 WORKDIR /app COPY package.json . RUN yarn global add gatsby-cli RUN yarn install COPY gatsby-config.js . COPY .env . EXPOSE 8000 CMD ["gatsby","develop","-H","0.0.0.0"]
我遇到了同样的问题,我所要做的就是将 Docker 配置文件名大写:
dockerfile> 没用
dockerfile
Dockerfile> 确实工作
Dockerfile