{"id":13567644,"url":"https://github.com/dokku/gitlab-ci","last_synced_at":"2026-03-15T00:57:41.268Z","repository":{"id":43184366,"uuid":"325500082","full_name":"dokku/gitlab-ci","owner":"dokku","description":"A collection of gitlab-ci examples","archived":false,"fork":false,"pushed_at":"2023-05-13T02:51:15.000Z","size":70,"stargazers_count":31,"open_issues_count":0,"forks_count":11,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-05-22T19:34:19.658Z","etag":null,"topics":["ci-cd","continuous-deployment","deployment","docker","dokku","gitlab-ci"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dokku.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"dokku","open_collective":"dokku","patreon":"dokku"}},"created_at":"2020-12-30T08:44:55.000Z","updated_at":"2024-05-08T18:39:50.000Z","dependencies_parsed_at":"2023-02-09T16:16:05.930Z","dependency_job_id":"d84f5f40-c3cd-4046-bf73-e24d8cd74222","html_url":"https://github.com/dokku/gitlab-ci","commit_stats":{"total_commits":40,"total_committers":3,"mean_commits":"13.333333333333334","dds":"0.050000000000000044","last_synced_commit":"3ed2db5f95049a519282e547f0df7c3679d161a8"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dokku%2Fgitlab-ci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dokku%2Fgitlab-ci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dokku%2Fgitlab-ci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dokku%2Fgitlab-ci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dokku","download_url":"https://codeload.github.com/dokku/gitlab-ci/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":205624609,"owners_count":14455106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci-cd","continuous-deployment","deployment","docker","dokku","gitlab-ci"],"created_at":"2024-08-01T13:02:37.590Z","updated_at":"2026-03-15T00:57:36.219Z","avatar_url":"https://github.com/dokku.png","language":"Shell","funding_links":["https://github.com/sponsors/dokku","https://opencollective.com/dokku","https://patreon.com/dokku"],"categories":["Shell"],"sub_categories":[],"readme":"# gitlab-ci\n\nA collection of gitlab-ci examples\n\n## Requirements\n\nPlease note that these workflows are compatible with `dokku \u003e= 0.11.6`.\n\n## Usage\n\nAll examples require a `SSH_PRIVATE_KEY` environment variable set for the Gitlab CI pipeline. This may be set via a \"secret variable\". See [this doc](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) for instructions on creating a new ssh key. Be careful not to overwrite existing keys on the generating machine by using a new name.\n\n### Adding a secret variable\n\nBrowse to the repository in question and visit the following path: `the Gitlab project \u003e Settings \u003e CI/CD.`\n\nClick on `Secret variables \u003e Expand` and fill in the blanks.\n\n- Key: `SSH_PRIVATE_KEY`\n- Value: paste in an SSH private key registered in Dokku:\n\n    -----BEGIN RSA PRIVATE KEY-----\n    ...\n    -----END RSA PRIVATE KEY-----\n\n- Environment scope: `production` (This make sure that `SSH_PRIVATE_KEY` is not available on merge requests or tests)\n- Protected: Do not check this checkbox unless you know what you are doing\n\n## Environment Variables\n\n- `BRANCH`: (_optional_) The branch to deploy when pushing to Dokku. Useful when a [custom deploy branch](https://dokku.com/docs/deployment/methods/git/#changing-the-deploy-branch) is set on Dokku.\n  - default: `master`\n  - example value: `main`\n- `CI_BRANCH_NAME`: (_optional_) The branch name that triggered the deploy. Automatically detected from `CI_COMMIT_REF_NAME`.\n  - example value: `develop`\n- `CI_COMMIT`: (_optional_) The commit sha that will be pushed. Automatically detected from `CI_COMMIT_SHA`.\n  - example value: `0aa00d8dd7c971c121e3d1e471d0a35e1daf8abe`\n- `COMMAND`: (_optional_) The command to run for the action.\n  - default: `deploy`\n  - valid values:\n    - `deploy`\n    - `review-apps:create`: Used to create a review app - via `dokku apps:clone` - based on the `appname` configured in the `git_remote_url`. If the review app already exists, this action will not recreate the app. In both cases, the current commit will be pushed to the review app.\n    - `review-apps:destroy`: Destroys an existing review app.\n- `GIT_PUSH_FLAGS`: (_optional_) A string containing a set of flags to set on push. This may be used to enable force pushes, or trigger verbose log output from git.\n  - example value: `--force -vvv`\n- `GIT_REMOTE_URL`: (**required**) The dokku app's git repository url in SSH format.\n  - example value: `ssh://dokku@dokku.myhost.ca:22/appname`\n- `REVIEW_APP_NAME`: (_optional_) The name of the review app to create or destroy. Computed as `review-$APPNAME-$BRANCH_NAME` if not specified, where:\n\n  ```text\n  $APPNAME: The parsed app name from the `git_remote_url`\n  $BRANCH_NAME: The inflected git branch name\n  ```\n\n  - example value: `review-appname`\n- `SSH_HOST_KEY`: (_optional_) The results of running `ssh-keyscan -t rsa $HOST`. The github-action will otherwise generate this on the fly via `ssh-keyscan`.\n  - example value:\n\n    ```text\n    # dokku.com:22 SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.1\n    dokku.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCvS+lK38EEMdHGb...\n    ```\n\n- `SSH_PRIVATE_KEY`: (**required**) A private ssh key that has push access to the Dokku instance.\n  - tip: It is recommended to use [Encrypted Secrets](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets) to store sensitive information such as SSH Keys.\n  - example value:\n\n    ```text\n    -----BEGIN OPENSSH PRIVATE KEY-----\n    MIIEogIBAAKCAQEAjLdCs9kQkimyfOSa8IfXf4gmexWWv6o/IcjmfC6YD9LEC4He\n    qPPZtAKoonmd86k8jbrSbNZ/4OBelbYO0pmED90xyFRLlzLr/99ZcBtilQ33MNAh\n    ...\n    SvhOFcCPizxFeuuJGYQhNlxVBWPj1Jl6ni6rBoHmbBhZCPCnhmenlBPVJcnUczyy\n    zrrvVLniH+UTjreQkhbFVqLPnL44+LIo30/oQJPISLxMYmZnuwudPN6O6ubyb8MK\n    -----END OPENSSH PRIVATE KEY-----\n    ```\n\n## Examples\n\nAll examples below are functionally complete and can be copy-pasted into a `.gitlab-ci.yml` file, with some minor caveats:\n\n- The `GIT_REMOTE_URL` should be changed to match the server and app.\n- An [Gitlab Variable](https://docs.gitlab.com/ee/ci/variables/README.html#create-a-custom-variable-in-the-ui) should be set on the Gitlab repository with the name `SSH_PRIVATE_KEY` containing the contents of a private ssh key that has been added to the Dokku installation via the `dokku ssh-keys:add` command.\n- As pushing a git repository from a shallow clone does not work, all repository checkouts should use a `GIT_DEPTH` of `0`. All examples below have this option set correctly.\n\nFor simplicity, each example is standalone, but may be combined as necessary to create the desired effect.\n\n- [Simple Example](/example-pipelines/simple.yaml): Deploys a codebase on push or merge to master.\n- [Build in CI and Deploy an image](/example-pipelines/build-and-deploy.yaml): Builds a docker image in CI, pushes the image to the remote Docker Hub repository, and then notifies Dokku to deploy the built image.\n- [Cancel previous runs on new push](/example-pipelines/cancel-previous-runs.yaml): This pipeline is particularly useful when triggered by new pushes.\n- [Avoid SSH Host Keyscan](/example-pipelines/specify-ssh-host-key.yaml): By default, this action will scan the host for it's SSH host key and use that value directly. This may not be desirable for security compliance reasons.\n\n  The `SSH_HOST_KEY` value can be retrieved by calling `ssh-keyscan -t rsa $HOST`, where `$HOST` is the Dokku server's hostname.\n- [Specify a custom deploy branch](/example-pipelines/custom-deploy-branch.yaml): Certain Dokku installations may use custom deploy branches other than `master`. In the following example, we push to the `develop` branch.\n- [Verbose Push Logging](/example-pipelines/verbose-logging.yaml): Verbose client-side logging may be enabled with this method. Note that this does not enable trace mode on the deploy, and simply tells the `git` client to enable verbose log output\n- [Force Pushing](/example-pipelines/force-push.yaml): If the remote app has been previously pushed manually from a location other than CI, it may be necessary to enable force pushing to avoid git errors.\n- [Review Apps](/example-pipelines/review-app.yaml): Handles creation and deletion of review apps through use of `dokku apps:clone` and `dokku apps:destroy`. Review apps are a great way to allow folks to preview pull request changes before they get merged to production.\n  - Placing a shell script at `bin/ci-pre-deploy` can be used to reconfigure the app, as shown in [this example](/example-pipelines/review-app/ci-pre-deploy).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdokku%2Fgitlab-ci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdokku%2Fgitlab-ci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdokku%2Fgitlab-ci/lists"}