To compile code into assets/artifacts and build a Docker image with the resulting code only, and no compilers/devel packages/libraries, you have a workflow like so:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script that can be run to cleanup a Jenkins slave server that's used to build docker images | |
# Tries to account for the fact that a job might be running and using images & containers | |
# Adjust the Docker command to match your environment (esp. the $HOST hostname) | |
# TLS included as script it designed to be run from the master | |
DOCKER_TLS_VERIFY=1 | |
DOCKER="docker --tlscacert /ca.pem --tlscert /cert.pem --tlskey /key.pem -H ${HOST}" | |
RUNNING_CONTAINERS=$($DOCKER ps -q) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
## Snippet of Ansible Playbook for auto-expanding a volume group based on disks on the server | |
### Format Partitions ### | |
- name: Format | find disks | |
command: find /dev -regex "/dev/sd[b-z]" -exec echo "{}," \; | |
register: extra_pvs | |
- name: Format | expand vg if extra_pvs exist | |
# defaultpv comes last, because extra_pvs are formatted to have a comma on the end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage () { | |
cat << EOF | |
Usage: dkr HOSTNAME | |
dkr HOSTNAME COMMAND [arg...] | |
A wrapper around Docker to simplify using TLS connections | |
In the first form, will watch the output of "docker ps" and "docker images" on the remote host. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 /) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": []} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |