Skip to content

Untitled

Each actor depends on inarupa and actors_shared as path dependencies pointing outside the actor directory:

# actor mix.exs
defp deps do
[
{:inarupa, path: "../../inarupa"},
{:actors_shared, path: "../actors_shared"}
]
end

This works for local development — Mix resolves them from the monorepo. But Docker builds can only see files within the build context (the actor directory). The path deps don’t exist there.

mix image.prepare — Copies inarupa and actors_shared into the actor directory using git ls-files to include only tracked files (respects .gitignore, skips _build, deps, etc.).

mix image.build [name] [tag] — Runs prepare, then docker build.

mix image.clean — Removes the copied directories.

ScenarioNeed image.prepare?
Local dev (mix test, iex -S mix)No — path deps resolve from monorepo
docker build locallyYes — Docker needs files in build context
apify push (remote build)Yes — same Docker constraint
CI/CDYes — if building Docker images

The Dockerfiles expect the prepared directories at the root of the build context:

COPY actors_shared/mix.exs /app/apify_actors/actors_shared/
COPY inarupa/mix.exs /app/inarupa/
COPY mix.exs /app/apify_actors/<actor_name>/
# deps.get, then:
COPY actors_shared/lib/ /app/apify_actors/actors_shared/lib/
COPY inarupa/lib/ /app/inarupa/lib/
COPY lib/ /app/apify_actors/<actor_name>/lib/

This layered COPY ensures Docker caching works: dependency versions change rarely, so deps.get is cached. Only lib/ changes invalidate the compile step.