Update Git config
Add this to the [upstream] section in .git/config
fetch = +refs/tags/*:refs/tags/*
#!/bin/bash | |
# This script should be located on each Jenkins slave, and the jenkins user should have permission to run it with sudo | |
# Attempts to cleanly stop and remove all containers, volumes and images. | |
docker ps -q | xargs --no-run-if-empty docker stop | |
docker ps -q -a | xargs --no-run-if-empty docker rm --force --volumes | |
docker volume ls -q | xargs --no-run-if-empty docker volume rm | |
docker images -a -q | xargs --no-run-if-empty docker rmi -f | |
# Stops the docker service, unmounts all docker-related mounts, removes the entire docker directory, and starts docker again. |
This is an example of a workflow we've developed to develop Ruby on Rails applications in Docker containers, to assure the local development occurs in the same environment as the production workload. It also has the side benefit of making local development easier: every project can be built with whatever dependencies or libraries are desired, without having to try to install them on the developers' local machines. In addition, local tools and direct code manipulation are still possible, making development feel entirely native to the local machine.
This general workflow works for other languages just as easily. See the "What about other languages?" section, below.
Assumptions:
version: '2' | |
services: | |
mongodb: | |
build: | |
dockerfile: ./Dockerfile-centos | |
context: https://github.com/CommunityHoneyNetwork/mongodb.git | |
image: mongodb:centos | |
ports: | |
- "127.0.0.1:27017:27017" | |
volumes: |
FROM ubuntu:17.10 | |
MAINTAINER Chris Collins <[email protected]> | |
ENV PKGS python python-pip nginx runit | |
RUN apt-get update && \ | |
DEBIAN_FRONTEND=noninteractive apt-get install -y $PKGS | |
RUN pip install mkdocs | |
ADD default /etc/nginx/sites-enabled/default |
#!/bin/bash | |
set -o errexit | |
set -o nounset | |
main () { | |
local mongo_repo="https://github.com/CommunityHoneyNetwork/mongodb.git" | |
local mongo_commit="c95ab34ba961b4e29b9973a7eec2d0133f15be5c" | |
local redis_repo="https://github.com/CommunityHoneyNetwork/redis.git" | |
local redis_commit="b7ad930a8d7a0296fb2fadf955e2a58c3aee73e4" |
fatal: [10.0.11.227]: FAILED! => {"changed": false, "cmd": ["/usr/local/bin/oc", "create", "-n", "openshift", "-f", "/etc/origin/examples/image-streams/image-streams-centos7.json"], "delta": "0:00:00.648866", "end": "2017-05-22 19:52:08.699647", "failed": true, "failed_when_result": true, "rc": 1, "start": "2017-05-22 19:52:08.050781", "stderr": "Unable to connect to the server: dial tcp: lookup <HOSTNAME OF ELB FOR MASTERS> on 10.0.0.2:53: no such host", "stderr_lines": ["Unable to connect to the server: dial tcp: lookup <HOSTNAME OF ELB FOR MASTERS> on 10.0.0.2:53: no such host"], "stdout": "", "stdout_lines": []} |
#!/bin/bash | |
# Super basic script outlining the steps to enable namespace support for Docker on | |
# el7-base systems (CentOS7, RHEL7, etc). | |
set -e | |
echo "Enabling user_namespace kernel option..." | |
grubby --args="user_namespace.enable=1" --update-kernel="$(grubby --default-kernel)" |
# Found on Reddit - cannot now remember where | |
# Modified by Chris Collins to suite his tastes | |
git rev-parse 2> /dev/null && git status --porcelain -b | awk ' | |
/^## / { | |
branch = $0; | |
sub(/^## /, "", branch); | |
sub(/\.\.\..*/, "", branch); | |
if ($0 ~ /ahead /) { |