{"id":18256463,"url":"https://github.com/baderlab/docker-deploy","last_synced_at":"2025-04-08T22:27:39.886Z","repository":{"id":91866622,"uuid":"569896040","full_name":"BaderLab/docker-deploy","owner":"BaderLab","description":"Automatic docker deployments on git push","archived":false,"fork":false,"pushed_at":"2022-11-23T22:35:47.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-14T17:42:48.481Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/BaderLab.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-23T21:38:22.000Z","updated_at":"2022-11-23T21:41:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"cce51f1b-9866-4db3-93b5-658a3bd19bb0","html_url":"https://github.com/BaderLab/docker-deploy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaderLab%2Fdocker-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaderLab%2Fdocker-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaderLab%2Fdocker-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaderLab%2Fdocker-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaderLab","download_url":"https://codeload.github.com/BaderLab/docker-deploy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247937480,"owners_count":21021268,"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":[],"created_at":"2024-11-05T10:22:03.117Z","updated_at":"2025-04-08T22:27:39.857Z","avatar_url":"https://github.com/BaderLab.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-deploy\nAutomatic docker deployments on git push\n\n## What does this do?\n\nThis script automates deploying your service when you do a `git push` to your main branch:\n\n1. It deploys when you have a new commit on `main`.\n2. It takes your `Dockerfile` in your repo and builds an image.\n3. It deploys your docker image as a service.\n4. It notifies you on slack that the deployment has completed.\n\nThis is only for simple deployments.\n\n## Prerequisites\n\nYou must use this on Linux or Mac.  This script has been tested on Ubuntu VMs.  You must have the following installed:\n\n- bash\n- git\n- curl\n- [docker](https://docs.docker.com/engine/install/ubuntu/), with docker swarm turned on\n- tee (nice but optional)\n\nYou must have the following environment variables defined to use this script:\n\n- `IMAGE_NAME` : the name of your docker image\n- `SERVICE_NAME` [optional] : the name of your docker service (defaults to `IMAGE_NAME` with 'service' appended)\n- `REPO_DIR` : the absolute path of your repo on the file system\n- `BRANCH` [optional] : the git branch to deploy (default `main`)\n- `PORT` : the port to deploy your service (e.g. 3000)\n- `SLACK_CHANNEL` : the slack channel to notify (e.g. `monitoring`)\n- `SLACK_USERNAME` : the username of the slack org (e.g. `cytoscape`)\n- `SLACK_AUTHOR` : the name of your [slack app / webhook](https://api.slack.com/messaging/webhooks) (e.g. `Deploy Bot`)\n- `SLACK_HOOK` : the slack [hook address](https://api.slack.com/messaging/webhooks)\n\n## Usage\n\nClone your repo:\n\n```\ncd ~\ngit clone https://example.com/myservice.git # replace with your repo\n```\n\nSet up a cron job:\n\n```\ncrontab -e\n```\n\nSet the job for something like every 5 minutes:\n\n```\n*/5 * * * * /home/myusername/myservice.sh\n```\n\nYou can define your variables in a script like `~/myservice.sh`:\n\n```\n#!/bin/bash\n\n# Variables for docker-deploy.sh\nexport IMAGE_NAME=\"myservice\"\nexport REPO_DIR=\"~/myservice\"\nexport PORT=\"3000\"\nexport SLACK_CHANNEL=\"monitoring\"\nexport SLACK_USERNAME=\"myslackorg\"\nexport SLACK_AUTHOR=\"Deploy Bot\"\nexport SLACK_HOOK=\"https://example.com/some/address/you/should/get/from/the/slack/docs\"\n\n# Note: If you have $REPO_DIR/.env on the file system, then that env file will be used by the docker container.\n\n# Run the deployment script and save the output to a log file.\n~/docker-deploy.sh | tee ~/$IMAGE_NAME.log\n```\n\n## What if I want to force a build?\n\nIf you set the `FORCE` environment variable to a value like `true`, then running `docker-deploy.sh` will rebuild and redeploy everything even if there isn't a new commit.\n\nE.g. with the above `myservice.sh`:\n\n```\nFORCE=true ~/myservice.sh\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaderlab%2Fdocker-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaderlab%2Fdocker-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaderlab%2Fdocker-deploy/lists"}