mongodb-labs/full-stack-fastapi-mongodb

celeryworker.dockerfile exiting with code: 1

aidancahill opened this issue · 7 comments

Docker compose build command exits with code: 1, line 17 - 20 in the celeryworker.dockerfile in the backend directory. Getting this response in the terminal "23.63 Environment production is not defined by project config
23.65 chmod: cannot access '/app/worker-start.sh'$'\r': No such file or directory

failed to solve: process "/bin/sh -c python -m pip install --no-cache-dir --upgrade pip "pipx==$PIPX_VERSION"\r\npipx install "hatch==$HATCH_VERSION"\r\nhatch env prune && hatch env create production\r\nchmod +x /app/worker-start.sh\r\n" did not complete successfully: exit code: 1"

Am I doing something wrong here? I definitely can be making a dumb config mistake. Default configuration to localhost.

Hey @aidancahill, thanks for your patience on this issue.

To start, could you share if you have the file /app/worker-start.sh in your backend directory? In your generated app the pathname should look like this {project_name}/backend/app/worker-start.sh? If not that may be the root issue. It may have been accidentally deleted or removed. Let me know if that helps. If not, we can follow up with this in a formal JIRA ticket.

Hey @Jibola,

Thanks for taking the time,

Yes in the directory {project_name}/backend/app/, I have a worker-start.sh. I was pretty sparse with the amount of context I provided in the original post, happy to provide any additional generated files to replicate the bug.

(The content of worker-start.sh)

#! /usr/bin/env bash
set -e

hatch run python /app/app/celeryworker_pre_start.py
hatch run celery -A app.worker worker -l info -Q main-queue -c 1

I have the same issue.

I am also getting this issue.

Hey guys I solved the issue by separating out the RUN commands in the celeryworker.dockerfile, like this:

RUN python -m pip install --no-cache-dir --upgrade pip "pipx==$PIPX_VERSION"
RUN pipx install "hatch==$HATCH_VERSION"
RUN hatch env prune && hatch env create production
RUN chmod +x /app/worker-start.sh

Thanks @csouflis! I opened https://jira.mongodb.org/browse/PYTHON-4351 to track this bug.

I applied the change in #38.