├── Dockerfile ├── Makefile ├── README.md ├── TAG ├── mongo ├── Dockerfile ├── README.md └── docker-entrypoint.sh ├── start.sh ├── strider.conf └── sv_stdout.conf /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | MAINTAINER Keyvan Fatehi 3 | 4 | ENV STRIDER_TAG v1.6.4 5 | ENV STRIDER_REPO https://github.com/Strider-CD/strider 6 | 7 | RUN locale-gen en_US.UTF-8 8 | ENV LANG en_US.UTF-8 9 | ENV LANGUAGE en_US:en 10 | ENV LC_ALL en_US.UTF-8 11 | 12 | RUN apt-get update && \ 13 | apt-get install -y git supervisor python-pip curl && \ 14 | pip install supervisor-stdout && \ 15 | sed -i 's/^\(\[supervisord\]\)$/\1\nnodaemon=true/' /etc/supervisor/supervisord.conf && \ 16 | curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - && \ 17 | apt-get install -y nodejs 18 | 19 | ADD sv_stdout.conf /etc/supervisor/conf.d/ 20 | 21 | VOLUME /home/strider/.strider 22 | RUN mkdir -p /home/strider && mkdir -p /opt/strider 23 | RUN adduser --disabled-password --gecos "" --home /home/strider strider 24 | RUN chown -R strider:strider /home/strider 25 | RUN chown -R strider:strider /opt/strider 26 | RUN ln -s /opt/strider/src/bin/strider /usr/local/bin/strider 27 | USER strider 28 | ENV HOME /home/strider 29 | 30 | RUN git clone --branch $STRIDER_TAG --depth 1 $STRIDER_REPO /opt/strider/src && \ 31 | cd /opt/strider/src && npm install && npm run build 32 | COPY start.sh /usr/local/bin/start.sh 33 | ADD strider.conf /etc/supervisor/conf.d/strider.conf 34 | EXPOSE 3000 35 | USER root 36 | CMD ["bash", "/usr/local/bin/start.sh"] 37 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | DB="DB_URI=mongodb://keyvan:mypass@ds041380.mongolab.com:41380/strider-testing" 2 | TAG=`cat TAG` 3 | 4 | build: 5 | docker build -t $(TAG) . 6 | 7 | push: build 8 | docker push $(TAG) 9 | 10 | test: build 11 | docker run --rm -p 3000:3000 -e $(DB) -e GENERATE_ADMIN_USER=true -t $(TAG) 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-strider 2 | 3 | Semi-official docker build that does NOT ship with internal Mongo or SSH. 4 | 5 | It contains supervisord, latest strider, its dependent modules and nodejs/npm. 6 | 7 | You must pass in a DB_URI with a valid mongodb connection string. 8 | 9 | ## Pulling 10 | 11 | Hosted on Quay.io. Find what to `docker pull` by checking the TAG file 12 | 13 | ## Building 14 | 15 | Clone the project and `docker build -t .` 16 | 17 | ## Running 18 | 19 | Say you've created a database at MongoLab, here's how you would run it: 20 | 21 | `docker run -e "DB_URI=mongodb://keyvan:mypass@ds041380.mongolab.com:41380/strider-testing" ` 22 | 23 | ## Linking 24 | 25 | A compatible mongo image is included. 26 | 27 | Following example should lead you into a side-by-side mongo/strider containers creation. 28 | 29 | Building image `mongodb-img`: 30 | `docker build -t mongodb-img ./mongo` 31 | 32 | Building image `strider-img`: 33 | `docker build -t strider-img .` 34 | 35 | Launching a container called `database` based on previously built image `mongodb-img`: 36 | `docker run -d --name database -i mongodb-img` 37 | Notice that no ports were exposed. 38 | 39 | Now we would create a container called `strider` based on previously built image `strider-img` image that is linked to previous launched `database` container. We also gonna to expose `strider:3000` into `host:80`. 40 | ```bash 41 | docker run -d \ 42 | --name strider \ 43 | --link database:database \ 44 | -e "DB_URI=mongodb://database:27017" \ 45 | -p 80:3000 \ 46 | strider-img 47 | ``` 48 | 49 | 50 | ## Security 51 | 52 | This image can generate an admin user with a random password. Set environment variable `GENERATE_ADMIN_USER` to use this feature. 53 | -------------------------------------------------------------------------------- /TAG: -------------------------------------------------------------------------------- 1 | quay.io/keyvanfatehi/strider:v1.6.4 2 | -------------------------------------------------------------------------------- /mongo/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:wheezy 2 | 3 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 4 | RUN groupadd -r mongodb && useradd -r -g mongodb mongodb 5 | 6 | RUN apt-get update \ 7 | && apt-get install -y curl \ 8 | && rm -rf /var/lib/apt/lists/* 9 | 10 | RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \ 11 | && chmod +x /usr/local/bin/gosu 12 | 13 | RUN gpg --keyserver pgp.mit.edu --recv-keys BDC0DB28022D7DEA1490DC3E7085801C857FD301 14 | 15 | ENV MONGO_VERSION 2.7.7 16 | 17 | RUN curl -SL "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-$MONGO_VERSION.tgz" -o mongo.tgz \ 18 | && curl -SL "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-$MONGO_VERSION.tgz.sig" -o mongo.tgz.sig \ 19 | && gpg --verify mongo.tgz.sig \ 20 | && tar -xvf mongo.tgz -C /usr/local --strip-components=1 \ 21 | && rm mongo.tgz* 22 | 23 | VOLUME /data/db 24 | 25 | COPY docker-entrypoint.sh /entrypoint.sh 26 | ENTRYPOINT ["/entrypoint.sh"] 27 | 28 | EXPOSE 27017 29 | CMD ["mongod"] 30 | -------------------------------------------------------------------------------- /mongo/README.md: -------------------------------------------------------------------------------- 1 | Same as https://registry.hub.docker.com/_/mongo/ 2 | 3 | Source: https://github.com/docker-library/mongo/tree/master/2.7 4 | 5 | # Linking 6 | 7 | docker run --name some-app --link some-mongo:mongo -d application-that-uses-mongo 8 | -------------------------------------------------------------------------------- /mongo/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | if [ "$1" = 'mongod' ]; then 5 | chown -R mongodb /data/db 6 | exec gosu mongodb "$@" 7 | fi 8 | 9 | exec "$@" 10 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | chown -R strider:strider /home/strider 2 | 3 | if [[ -n $GENERATE_ADMIN_USER ]]; then 4 | ADMIN="admin@${FQDN-example.org}" 5 | PASSWD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) 6 | strider addUser --email $ADMIN --password $PASSWD --admin true && 7 | echo "Admin User: $ADMIN, Admin Pass: $PASSWD" 8 | fi 9 | 10 | supervisord -c /etc/supervisor/supervisord.conf 11 | -------------------------------------------------------------------------------- /strider.conf: -------------------------------------------------------------------------------- 1 | [program:strider] 2 | command=strider 3 | stdout_events_enabled=true 4 | stderr_events_enabled=true 5 | autorestart=true 6 | user=strider 7 | stopasgroup=true 8 | environment=NODE_ENV=production 9 | -------------------------------------------------------------------------------- /sv_stdout.conf: -------------------------------------------------------------------------------- 1 | [eventlistener:stdout] 2 | command = supervisor_stdout 3 | buffer_size = 100 4 | events = PROCESS_LOG 5 | result_handler = supervisor_stdout:event_handler 6 | --------------------------------------------------------------------------------