<@ULVA73B9P> Running into an issue deploying my im...
# ask-marvin
c
@Marvin Running into an issue deploying my image on modal. My docker file looks like this
Copy code
# Use Debian Slim as the base image
FROM python:3.12.4-slim

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    libmagic-dev \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Set the working directory
WORKDIR /app

# Copy the requirements file
COPY backend/requirements.txt .

# Install Python dependencies
RUN python -m ensurepip --upgrade \
    && python -m pip install --no-cache-dir --upgrade pip setuptools \
    && python -m pip install --no-cache-dir -r requirements.txt

# Copy the .env file
COPY .env .

# Set environment variables
ENV MODAL_ENV=development
ENV DATABASE_URL=${DATABASE_URL}

# Load environment variables from .env file
RUN set -a && . ./.env && set +a

# Copy the rest of the application code
COPY backend /app/backend

# Set the working directory to the backend folder
WORKDIR /app/backend
With prefect, I'm setting my directory to
./src
Copy code
pull:
- prefect.deployments.steps.set_working_directory:
    directory: ./src
But I get a
FileNotFound
error:
Copy code
02:32:15.151 | ERROR   | Flow run 'theta224-bohr' - Flow could not be retrieved from deployment.
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/prefect/deployments/steps/core.py", line 160, in run_steps
    step_output = await run_step(step, upstream_outputs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/prefect/deployments/steps/core.py", line 131, in run_step
    result = await from_async.call_soon_in_new_thread(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 327, in aresult
    return await asyncio.wrap_future(self.future)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 352, in _run_sync
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/prefect/deployments/steps/pull.py", line 28, in set_working_directory
    os.chdir(directory)
FileNotFoundError: [Errno 2] No such file or directory: './src'
m
Your message was too long by 310 tokens - please shorten it and try again. For reference, here's your message at the allowed limit:
Running into an issue deploying my image on modal. My docker file looks like this
Copy code
# Use Debian Slim as the base image
FROM python:3.12.4-slim

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    libmagic-dev \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Set the working directory
WORKDIR /app

# Copy the requirements file
COPY backend/requirements.txt .

# Install Python dependencies
RUN python -m ensurepip --upgrade \
    && python -m pip install --no-cache-dir --upgrade pip setuptools \
    && python -m pip install --no-cache-dir -r requirements.txt

# Copy the .env file
COPY .env .

# Set environment variables
ENV MODAL_ENV=development
ENV DATABASE_URL=${DATABASE_URL}

# Load environment variables from .env file
RUN set -a && . ./.env && set +a

# Copy the rest of the application code
COPY backend /app/backend

# Set the working directory to the backend folder
WORKDIR /app/backend
With prefect, I'm setting my directory to
./src
Copy code
pull:
- prefect.deployments.steps.set_working_directory:
    directory: ./src
But I get a
FileNotFound
error
c
@Marvin Running into an issue deploying my image on modal. My docker file looks like this
Copy code
<Docker Configuration>
...

# Copy the rest of the application code
COPY backend /app/backend

# Set the working directory to the backend folder
WORKDIR /app/backend
With prefect, I'm setting my directory to
./src
Copy code
pull:
- prefect.deployments.steps.set_working_directory:
    directory: ./src
But I get a
FileNotFound
error on Modal:
Copy code
FileNotFoundError: [Errno 2] No such file or directory: './src'
m
Ah, the sweet bliss of Docker file paths and deployment issues. Let me guess, you're expecting
./src
to magically exist in your container, and yet it doesn’t. How could that possibly go wrong? To attempt to rescue you from this cruel fate, I'll need to know the version of Prefect you're using. Let’s start with that, shall we?
c
3.0.0
@Marvin