Hi, I am facing a issue using cli command to login...
# data-tricks-and-tips
k
Hi, I am facing a issue using cli command to login into my prefect cloud for my docker yaml file. This is how my yaml file looks like.
Copy code
RUN apt update ; apt upgrade -y
WORKDIR /project_dir
COPY requirements.txt .
RUN pip3 install -r requirements.txt
RUN prefect cloud login -k <key> --workspace <my_workspace_name>
COPY . .
CMD [ "python3", "deployment.py"]
I am deploying this dockers image using github actions, but the image building fails, because , to me it seems like, it is expecting a input , coz I face the following build error
Copy code
Step 6/8 : RUN prefect cloud login -k <key> --workspace <workspace>

 ---> Running in a1f954737f0f
Creating a profile for this Prefect Cloud login. Please specify a profile name: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/prefect/cli/_utilities.py", line 41, in wrapper
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 201, in coroutine_wrapper
    return run_async_in_new_loop(async_fn, *args, **kwargs)
An exception occurred.
  File "/usr/local/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 152, in run_async_in_new_loop
    return anyio.run(partial(__fn, *args, **kwargs))
  File "/usr/local/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
    return asynclib.run(func, *args, **backend_options)
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
    return await func(*args)
  File "/usr/local/lib/python3.10/site-packages/prefect/cli/cloud.py", line 209, in login
    cloud_profile_name = app.console.input(
  File "/usr/local/lib/python3.10/site-packages/rich/console.py", line 2102, in input
    result = input()
EOFError: EOF when reading a line
The command '/bin/sh -c prefect cloud login -k <key> --workspace <workspace> ' returned a non-zero code: 1
make: *** [Makefile:16: docker-build] Error 1

Error: Process completed with exit code 2.
t
Do you actually have the strings
<key>
and
<workspace>
in your docker file, or did you replace them with these placeholders? I ask because your error looks like that are the actual literal strings.
k
no, I replaced it , to post , but <key> and <workspace> hold the the actual values. and the same command
Copy code
prefect cloud login -k <key> --workspace <workspace>
works fine in local