Learn about Apify Actor source types and how to deploy an Actor from GitHub using CLI or Gist.
This option is used by default when your Actor's source code is hosted on the Apify platform. You can use our Web IDE to preview and update your Actor's source code and browse its files and directories. This is especially helpful when you need to make fast updates to your source code or README or when you want to directly test the INPUT_SCHEMA.json on the Apify platform.
The only required file is Dockerfile, and all other files depend on your Dockerfile settings. By default, Apify's custom NodeJS Dockerfile is used, which requires a main.js file containing your source code and a package.json file containing package configurations for NPM.
If the Actor's source code is hosted externally in a Git repository, it can consist of multiple files and directories, use its own Dockerfile to control the build process (see Custom Dockerfile for details) and have a user description in store fetched from the README.md file. The location of the repository is specified by the Git URL setting, which can be an https, git or ssh URL.
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
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.
If your source code is hosted in a private Git repository, then you need to configure the deployment key. The deployment key is different for each Actor and may be used only once for the Git hosting of your choice (GitHub, Bitbucket, GitLab, etc.).
To obtain the key click at the deployment key link under the Git URL text input and follow the instructions there.
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. This is useful for sharing code between multiple Actors in the same repository.
If you want to have multiple Actors in a single repository using 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.
To enable sharing Dockerfiles between mutliple Actors, the Actor build process passes the
ACTOR_PATH_IN_DOCKER_CONTEXT build arg to the Docker build.
It contains the relative path from
dockerContextDir to the directory selected as the root of the Actor in the Apify Console (the "directory" part of the Actor's git URL).
An example Actor monorepo is shown in the
apify/actor-monorepo-example repository. To build Actors from this monorepo, you would set the source URL to
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, the source code can consist of multiple files and directories and can contain a custom Dockerfile. The Actor description is taken from the README.md. If you don't use a custom Dockerfile, the root file of your application must be named
Sometimes having a full Git repository or a hosted Zip file might be overly complicated for your small project, but you still want to have the source code in multiple files. In this case, you can simply put your source code into a GitHub Gist. For example:
Then set the Source Type to GitHub Gist and paste the Gist URL as follows:
Note that the example Actor is available in the Apify Store as apify/example-github-gist.
Similarly, as with the Git repository, the source code can consist of multiple files and directories and can contain a custom Dockerfile. The Actor description is taken from the README.md. If you don't use a custom Dockerfile, the root file of your application must be named