Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
730 views
in Technique[技术] by (71.8m points)

heroku - Nx - Run Commands - Docker

I'm currently trying to configure my workspace.json file to include the commands to build a docker image and push it. These commands work running them through the terminal (bash or windows), but I would like to get them setup in the cli so I can pass in the appName.

Project Structure

   ---/
      Dockerfile.api
      workspace.json
      ....

Configuration

{
  "version": 1,
  "projects": {
    "api": {
      "heroku-deploy": {
        "builder": "@nrwl/workspace:run-commands",
        "options": {
          "commands": [
            {
              "command": "docker build -t registry.heroku.com/{args.appName}/web -f ./Dockerfile.api ."
            },
            {
              "command": "docker push registry.heroku.com/{args.appName}/web"
            },
            {
              "command": "heroku container:release web -a {args.appName}"
            }
          ]
        }
      }
    }
  }
}

Running the command

nx run api:heroku-deploy2 --args="--appName=nx-api-leopard" --verbose

Error

#1 [internal] load build definition from Dockerfile.web
#1 sha256:8f9045a5ed51569cdcff9c6e9f9052e7e724435b6f2eeec087ea2770af2a3b0d
#1 transferring dockerfile: 2B done
#1 DONE 0.0s
failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount178807147/Dockerfile.web: no such file or directory
Warning: @nrwl/run-commands command "docker build -t registry.heroku.com/my-nx-app/web -f ./Dockerfile.web ." exited with non-zero status code

Resources

question from:https://stackoverflow.com/questions/66068205/nx-run-commands-docker

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...