├── .gitignore ├── Dockerfile ├── drone.sh ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM fedora:20 2 | 3 | RUN yum update -y -q; yum clean all 4 | RUN yum install -y -q git wget docker-io bind-utils; yum clean all 5 | RUN yum install -y -q http://downloads.drone.io/master/drone.rpm; yum clean all 6 | RUN mkdir -p /var/cache/drone 7 | 8 | # RUN wget https://github.com/coreos/etcd/releases/download/v0.4.6/etcd-v0.4.6-linux-amd64.tar.gz \ 9 | # -O - | tar -xz -C /tmp; \ 10 | # mv /tmp/etcd*/etcdctl /usr/bin; \ 11 | # rm -f /tmp/etcd* 12 | 13 | ADD drone.sh /usr/local/bin/drone.sh 14 | 15 | ENV DRONE_SERVER_PORT :80 16 | EXPOSE 80 17 | VOLUME /var/lib/drone 18 | VOLUME /var/cache/drone 19 | VOLUME /tmp/drone 20 | WORKDIR /var/lib/drone 21 | 22 | ENTRYPOINT ["/usr/local/bin/drone.sh"] 23 | -------------------------------------------------------------------------------- /drone.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # A hacky way to discover docker hosts 4 | if [[ ! -n ${DRONE_WORKER_NODES} ]] && [[ -n ${DOCKER_HOST_DNS} ]]; then 5 | workers=$(host -4 -t A ${DOCKER_HOST_DNS} | awk 'NR > 1 { printf(",") } /has address/ {printf("tcp://%s:2375", $4)}') 6 | export DRONE_WORKER_NODES=${workers} 7 | fi 8 | 9 | if [[ ${DRONE_REGISTRY_HOST} ]] && [[ ${DRONE_REGISTRY_AUTH} ]]; then 10 | cat < /root/.dockercfg 11 | { 12 | "${DRONE_REGISTRY_HOST}": { 13 | "email": "", 14 | "auth": "${DRONE_REGISTRY_AUTH}" 15 | } 16 | } 17 | EOF 18 | fi 19 | 20 | # Allow to pass in drone options after -- 21 | if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then 22 | exec /usr/local/bin/droned "$@" 23 | fi 24 | 25 | # If number of args is more than 1 and no drone options are given, start 26 | # given command instead (i.e. /bin/bash) 27 | exec "$@" 28 | 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # drone-docker 2 | 3 | Docker built image is hosted here: https://registry.hub.docker.com/u/state/drone/ 4 | 5 | Drone CI docker image. 6 | 7 | The image is based on Fedora base image. It has docker, git, wget tools and 8 | obviously drone preinstall. 9 | 10 | ## Configuration 11 | 12 | Configuration is done using environment variables or by passing a config file 13 | via `--config drone.toml`. 14 | 15 | - `DOCKER_HOST_DNS` - if set, then before drone is started, a dns lookup will 16 | be done to resolve IPs and set them as `DRONE_WORKER_NODES` (poor man's hosts 17 | discovery). 18 | - `DRONE_REGISTRY_HOST` - private registry host 19 | - `DRONE_REGISTRY_AUTH` - private registry auth string (base64 encoded user:password) 20 | 21 | See https://github.com/drone/drone for more details. 22 | 23 | ## Running 24 | 25 | ```bash 26 | docker run \ 27 | -e DRONE_SERVER_PORT=:80 \ 28 | -p 80:80 state/drone 29 | ``` 30 | 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Equal Media Limited 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | --------------------------------------------------------------------------------