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

[BUG] New CLI installs are broken (also in Docker) #1484

Closed
2 tasks done
vypxl opened this issue Jul 18, 2024 · 2 comments
Closed
2 tasks done

[BUG] New CLI installs are broken (also in Docker) #1484

vypxl opened this issue Jul 18, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@vypxl
Copy link

vypxl commented Jul 18, 2024

Describe the bug.

When building the docker image from scratch and trying to run any command (e.g. config, it just prints a blank line and exits with code 1. Same when installing it via npm .

--version or --help work as expected.

This started today afternoon, since then I can't get any newly installed version to work.

Expected behavior

The cli should be doing its job.

Screenshots

$ cat /tmp/aapi/Dockerfile
FROM node:20-alpine

# Set ARG to explicit value to build chosen version. Default is "latest"
ARG ASYNCAPI_CLI_VERSION=

# Create a non-root user
RUN addgroup -S myuser && adduser -S myuser -G myuser

WORKDIR /app

# Since 0.14.0 release of html-template chromium is needed for pdf generation
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium-browser
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
# Since 0.30.0 release Git is supported and required as a dependency
# Since 0.14.0 release of html-template chromium is needed for pdf generation.
# More custom packages for specific template should not be added to this dockerfile. Instead, we should come up with some extensibility solution.
RUN apk --update add git chromium && \
    apk add --no-cache --virtual .gyp python3 make g++ && \
    rm -rf /var/lib/apt/lists/* && \
    rm /var/cache/apk/*

# Installing latest released npm package
RUN npm install --ignore-scripts -g @asyncapi/cli@"$ASYNCAPI_CLI_VERSION"

RUN chown -R myuser:myuser /usr/local/lib/node_modules && \
chown -R myuser:myuser /usr/local/bin

# Switch to the non-root user
USER myuser

ENTRYPOINT [ "asyncapi" ]
$ docker build -t aapi-test /tmp/aapi
[+] Building 501.3s (10/10) FINISHED                                                                                                                       docker:default
 => [internal] load build definition from Dockerfile                                                                                                                 0.0s
 => => transferring dockerfile: 1.17kB                                                                                                                               0.0s
 => WARN: LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 12)                                                    0.0s
 => WARN: LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 13)                                                    0.0s
 => [internal] load metadata for docker.io/library/node:20-alpine                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                    0.0s
 => => transferring context: 2B                                                                                                                                      0.0s
 => CACHED [1/6] FROM docker.io/library/node:20-alpine                                                                                                               0.0s
 => [2/6] RUN addgroup -S myuser && adduser -S myuser -G myuser                                                                                                      0.2s
 => [3/6] WORKDIR /app                                                                                                                                               0.1s
 => [4/6] RUN apk --update add git chromium &&     apk add --no-cache --virtual .gyp python3 make g++ &&     rm -rf /var/lib/apt/lists/* &&     rm /var/cache/apk  170.0s
 => [5/6] RUN npm install --ignore-scripts -g @asyncapi/cli@""                                                                                                      76.0s 
 => [6/6] RUN chown -R myuser:myuser /usr/local/lib/node_modules && chown -R myuser:myuser /usr/local/bin                                                          245.6s 
 => exporting to image                                                                                                                                               9.1s 
 => => exporting layers                                                                                                                                              9.0s 
 => => writing image sha256:54de8c4e1271f2eafbd1012c5ec867ef8f797a250650c464f4eab69f761dddea                                                                         0.0s 
 => => naming to docker.io/library/aapi-test                                                                                                                         0.0s 
                                                                                                                                                                          
 2 warnings found (use --debug to expand):
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 12)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 13)
# Just executing without arguments works
$ docker run --rm -it aapi-test
All in one CLI for all AsyncAPI tools

VERSION
  @asyncapi/cli/2.1.1 linux-x64 node-v20.15.1

USAGE
  $ asyncapi [COMMAND]

TOPICS
  config    CLI config settings
  generate  Generate models and template
  new       Creates a new asyncapi file
  start

COMMANDS
  bundle    Bundle one or multiple AsyncAPI Documents and their references together.
  config    CLI config settings
  convert   Convert asyncapi documents older to newer versions
  diff      Find diff between two asyncapi files
  generate  Generate typed models or other things like clients, applications or docs using AsyncAPI Generator templates.
  new       Creates a new asyncapi file
  optimize  optimize asyncapi specification file
  start
  validate  validate asyncapi file

# Trying to run config does not work (no output and return code 1)
$ docker run --rm -it aapi-test config


$ echo $?
1

How to Reproduce

  1. Download the Dockerfile from the repo
  2. Build the image
  3. Run it with config / generate ..

Please see execution report above.

🥦 Browser

None

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

None

@vypxl vypxl added the bug Something isn't working label Jul 18, 2024
Copy link
Contributor

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@vypxl
Copy link
Author

vypxl commented Jul 19, 2024

Well I can only explain it with dark magic.
It seems to have fixed itself, the same docker file now gives a working image..

@vypxl vypxl closed this as completed Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

1 participant