https://prefect.io logo
#prefect-community
Title
# prefect-community
m

Max Lei

03/01/2022, 11:58 PM
I'm trying to use
DockerRun
with
LocalStorage
but I have a
config.py
file that is not packaged in my package, but it is beside the
flow.py
however seems that
flow.py
was not able to access this. The working directory in docker is set to the same place where both
config.py
and
flow.py
. Is there a setting I can configure?
a

Anna Geller

03/02/2022, 12:05 AM
Yup, check out this thread with some examples 🙂 https://prefect-community.slack.com/archives/CL09KU1K7/p1646129678705759?thread_ts=1646127089.477499&cid=CL09KU1K7 you could use Docker storage or build a custom docker image to package this code
m

Max Lei

03/02/2022, 1:32 AM
@Anna Geller I've already have a package, but this config file couldn't be in the package because of auths. Is there a way to change working directory for prefect so that it can see the config file?
a

Anna Geller

03/02/2022, 12:00 PM
You absolutely can, there is a command WORKDIR you can use in a Dockerfile to specify custom working directory. See this line
and of course, you can pass some environment variables to your docker image on build so that you don't need to hardcode those in your Dockerfile e.g.
Copy code
docker build --build-arg ENV_VAR=sensitive_value .
check this for reference
m

Max Lei

03/02/2022, 10:01 PM
@Anna Geller Following up: I was able to get away with not having auth file in the package by doing:
Copy code
ENV PYTHONPATH "${PYTHONPATH}:/opt/prefect/flows/"
🙌 1
4 Views