Charles Liu
09/07/2024, 2:32 AM# 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
pull:
- prefect.deployments.steps.set_working_directory:
directory: ./src
But I get a FileNotFound
error:
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'
Marvin
09/07/2024, 2:32 AMRunning into an issue deploying my image on modal. My docker file looks like this
# 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
pull:
- prefect.deployments.steps.set_working_directory:
directory: ./src
But I get a FileNotFound
errorCharles Liu
09/07/2024, 2:34 AM<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
pull:
- prefect.deployments.steps.set_working_directory:
directory: ./src
But I get a FileNotFound
error on Modal:
FileNotFoundError: [Errno 2] No such file or directory: './src'
Marvin
09/07/2024, 2:34 AM./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?Charles Liu
09/07/2024, 2:34 AMCharles Liu
09/07/2024, 2:36 AM