Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nx-container build not pushing or loading images #946

Open
AlanGRutter opened this issue Jan 4, 2024 · 6 comments
Open

nx-container build not pushing or loading images #946

AlanGRutter opened this issue Jan 4, 2024 · 6 comments

Comments

@AlanGRutter
Copy link

I have followed the instructions in the documentation to either load an image into docker images or push to DockerHub by modifying the metadata section with project.json.

In both cases when I run the command, I get a warning 'No output specified with docker-container driver. Build result will only remain in the build cache.'. The command that was issues does not include the --load or --push options.

@gperdomor
Copy link
Owner

@AlanGRutter please share your config here 🙏🏻

@eric-deeporigin
Copy link

@gperdomor I'm experiencing the same issue with our recently migration to NX/nx-container. Building images produces the error @AlanGRutter mentioned.

This is our nx-container configuration for an app (redacted sensitive info) in our project.json

 "container": {
      "executor": "@nx-tools/nx-container:build",
      "dependsOn": ["build"],
      "options": {
        "engine": "docker",
        "metadata": {
          "images": [
            "xxxxxxxxxxx.dkr.ecr.us-west-1.amazonaws.com/my-service"
          ],
          "repository": "xxxxxxxxxxx.dkr.ecr.us-west-1.amazonaws.com",
          "platforms": ["linux/arm64"],
          "push": true,
          "tags": [
            "type=schedule",
            "type=ref,event=branch",
            "type=ref,event=tag",
            "type=ref,event=pr",
            "type=sha,prefix=sha-"
          ]
        }
      }
    }
    ```
    
   We are running this command in GH Actions via this step:
   
   ```yaml
         # Run the `container` nx target
      - name: Docker build & push
        env:
          INPUT_GITHUB_TOKEN: ${{ secrets.MY_GH_TOKEN }}
        run: |
          npx nx run-many -t container --parallel=5

Any help would be appreciated. We followed the documentation to set up the repo/project. Ie running...

nx g @nx-tools/nx-container:init

And selecting Docker

When we run the command in CI and locally, the image is produced, and we can docker run the image, and the apps spin up no problem. It's just the push step that is failing for us.

@eric-deeporigin
Copy link

The fix for us was to run the command with --push option as well

npx nx run-many -t container --parallel=5 --push

@srimanth-duggineni
Copy link

The fix for us was to run the command with --push option as well

Thank you, ran into this issue and adding --push worked!

@tomwidmer
Copy link

I think moving "push": true out of the metadata section into the root of options should work as well.

@gperdomor
Copy link
Owner

@eric-deeporigin your configuration is wrong, as @tomwidmer says, push option should not be inside metadata… please check this docs
Also you can check the complete schema here here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants