Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
776 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 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...