Build & Deploy
Deploy to Koyeb Button

Deploy to Koyeb Button

The Deploy to Koyeb button lets you deploy applications from a GitHub repository or a Docker image with a single click. As a developer, it lets you create a fast deployment option for your users.

You can add the Deploy to Koyeb button to your documentation and readme files to allow your users to deploy your application with zero configuration.

The Deploy to Koyeb button can be configured to deploy from GitHub repositories or public, pre-built Docker images hosted on a container registry. When configured to deploy from a private repository, the Koyeb user account must be linked with GitHub and have access to the repository.

Below is an example of the Deploy to Koyeb button that deploy a simple NestJS application on Koyeb from a public GitHub repository.

Deploy to Koyeb (opens in a new tab)

Add the Deploy to Koyeb button

To add the Deploy to Koyeb button to your repository, you can use the following Markdown snippet as a template:

[![Deploy to Koyeb](https://www.koyeb.com/static/images/deploy/button.svg)](https://app.koyeb.com/deploy?...)

Parameters

The Deploy to Koyeb button configuration is passed using URL query parameters. Be sure to percent encode (opens in a new tab) any values (like spaces) that might not be representable otherwise.

Below is the list of arguments accepted by the button:

Common arguments

  • type (required): The Deployment source to use. Can be git or docker, for example: type=git.
  • name (required): The name of the application to deploy, for example: name=my-app.
  • service_type: The type of Service to launch: either web or worker (defaults to web when not set).
  • instance_type: The type of Instance the Service should deployed. For example: instance_type=medium.
  • ports: A port to expose for your application. Port specifications consist of the port number, protocol, and path with each component separated by a semicolon. For example: ports=8080;http;/, or for multiple ports: ports=8080;http;/api&ports=8081;http;/.
  • env: An environment variable to pass to the application. For example: env[my-key]=my-value, or for multiple environment variables: env[myKey1]=myValue1&env[myKey2]=myValue2.
  • regions: A region where the Service should be deployed. For example: region=fra. Can be specified more than once to deploy to multiple regions: region=fra&region=par.
  • privileged: A boolean determining whether the Service container is run in privileged mode (opens in a new tab). This advanced feature is useful when you need elevated system privileges like, for example, to start a Docker daemon within the container (defaults to false when not set).

Git arguments

The following parameters are accepted when the button type is set to git:

  • repository (required): The repository to deploy from, for example: repository=github.com/koyeb/example-nestjs.
  • branch (required): The branch to deploy from, for example: branch=main.
  • workdir: The directory within the repository that holds the source code. If not set, the work directory defaults to the root of the repository. For example, workdir=packages/api.
  • builder: Whether to build using a native buildpack or from an included Dockerfile. Defaults to buildpack.

When the builder is set to buildpack, these parameters are also relevant:

  • run_command: When building with buildpacks, the command to run to launch the application deploying. For example: run_command=yarn%20start.
  • build_command: When building with buildpacks, the command to run during the build of your application. For example: build_command=yarn%20build.

When the builder is set to dockerfile, these additional parameters are available:

  • dockerfile: When building from a Dockerfile, the location of the Dockerfile relative to the work directory. For example, dockerfile=location/of/Dockerfile.
  • entrypoint: When building from a Dockerfile, overrides the default entrypoint (opens in a new tab) for the container. For example, entrypoint=my-script.sh.
  • command: When building from a Dockerfile, overrides the command (opens in a new tab) to execute at runtime. For example, command=/bin/sh.
  • args: When building from a Dockerfile, sets the arguments to the command (opens in a new tab) to execute at runtime. For example, args=arg1&args=arg2.
  • target: When building from a Dockerfile, sets the target build stage (opens in a new tab) to build within the Dockerfile. For example, target=builder.

Docker arguments

The following parameters accepted when the button type is set to docker:

  • image (required): The repository to deploy from, for example: image=docker.io/koyeb/koyeb-demo:latest.
  • entrypoint: Overrides the default entrypoint (opens in a new tab) for the container. For example, entrypoint=my-script.sh.
  • command: The command to run within the container, for example: command=/bin/sh.
  • args: The arguments to pass to the container command, for example: args=arg1&args=arg2.

Examples

Below are two examples of the minimal configuration of the Deploy to Koyeb button to:

  • Deploy from a public GitHub repository:
    [![Deploy to Koyeb](https://www.koyeb.com/static/images/deploy/button.svg)](https://app.koyeb.com/deploy?type=git&repository=github.com/koyeb/example-nestjs&branch=main&name=nestjs-on-koyeb)
  • Deploy from a container registry:
    [![Deploy to Koyeb](https://www.koyeb.com/static/images/deploy/button.svg)](https://app.koyeb.com/deploy?type=docker&image=docker.io/koyeb/demo&name=koyeb-demo)