Skip to content

Commit

Permalink
feat: Cherry-picking notes on monorepos from Franta
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrunkat committed May 18, 2023
1 parent 6fea3f2 commit 7d8119e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sources/platform/actors/development/source_code.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ To help you get started quickly, you can use the [apify/quick-start](https://api

To specify a Git branch or tag to check out, add a URL fragment to the URL. For example, to check out the **develop** branch, specify a URL such as `https://github.com/jancurn/some-actor.git#develop`.

Optionally, the second part of the fragment in the Git URL (separated by a colon) specifies the context directory for the Docker build. For example, `https://github.com/jancurn/some-actor.git#develop:some/dir` will check out the **develop** branch and set **some/dir** as a context directory for the Docker build.

Optionally, the second part of the fragment in the Git URL (separated by a colon) specifies the directory from which the Actor will be built (and where the `.actor`) folder is located. For example, `https://github.com/jancurn/some-actor.git#develop:some/dir` will check out the **develop** branch and set **some/dir** as the root directory of the Actor.
Note that you can easily set up an integration where the actor is automatically rebuilt on every commit to the Git repository. For more details, see [GitHub integration](./source_code.md).

### [](#private-repositories)Private repositories
Expand All @@ -41,6 +40,14 @@ If your source code is hosted in a private Git repository then you need to confi

To obtain the key click at the **deployment key** link under the **Git URL** text input and follow the instructions there.

### [](#actor-monorepos)Actor monorepos

By default, the context directory for the Docker build is the directory pointed to by the **Git URL** (or the repository root if no directory is specified). If you want to use a different directory for the Docker context, you can use the `dockerContextDir` property in the [Actor definition](./actor_config.md). This is useful for example for sharing code between multiple actors in the same repository.

If you want to have multiple actors in a single repository that use shared code also located in the repository, you can set `dockerContextDir` to the path to the folder which contains the actor's source and the shared code, and then copy both the actor's source and shared code to the Docker image in the Dockerfile.

An example actor monorepo is shown in the [`apify/actor-monorepo-example`](https://github.com/apify/actor-monorepo-example) repository. To build actors from this monorepo, you would set the source URL to `https://github.com/apify/actor-monorepo-example#main:actor_1` and `https://github.com/apify/actor-monorepo-example#main:actor_2` respectively.

## [](#zip-file)Zip file

The source code for the actor can also be located in a Zip archive hosted on an external URL. This option enables integration with arbitrary source code or continuous integration systems. Similarly, as with the [Git repository](#git-repository), the source code can consist of multiple files and directories, can contain a custom **Dockerfile** and the actor description is taken from **README.md**. If you don't use a [custom Dockerfile](#custom-dockerfile), the root file of your application must be named `main.js`.
Expand Down

0 comments on commit 7d8119e

Please sign in to comment.