Last active
March 10, 2017 08:16
-
-
Save marcofischer/28d42ac62e30496fe910d7c2386ff122 to your computer and use it in GitHub Desktop.
SFUG CGN Links
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
before_script: | |
- which bats | |
stages: | |
- build | |
- test | |
- deploy | |
- cleanup | |
docker_build_container: | |
stage: build | |
script: | |
- printenv | |
- sudo docker build --rm --build-arg VCS_REF=${CI_BUILD_REF} --build-arg VERSION=${CI_BUILD_TAG} --build-arg BUILD_DATE=`date +%Y%m%d%H%m%S` -t memcached-build . | |
test_container: | |
stage: test | |
script: | |
- bats test/test_*.bats | |
docker_deploy_latest: | |
stage: deploy | |
script: | |
- printenv | |
- sudo docker tag memcached-build big.registry.brainbits.net/server/memcached:latest | |
- sudo docker push big.registry.brainbits.net/server/memcached:latest | |
only: | |
- /^master$/ | |
docker_deploy_tag: | |
stage: deploy | |
script: | |
- printenv | |
- sudo docker tag memcached-build big.registry.brainbits.net/server/memcached:${CI_BUILD_TAG} | |
- sudo docker push big.registry.brainbits.net/server/memcached:${CI_BUILD_TAG} | |
only: | |
- tags | |
docker_image_cleanup: | |
stage: cleanup | |
script: | |
- sudo docker rmi --force $(sudo docker images -q memcached-build) |
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
DOCKER HUB | |
========== | |
https://hub.docker.com/explore/ | |
REST-API Beispiel library namespace: | |
https://hub.docker.com/v2/repositories/library/ | |
Docker Official Repository | |
https://docs.docker.com/docker-hub/official_repos/ | |
DOCKERFILE LOCALES | |
================== | |
RUN apt-get update && apt-get install -y \ | |
locales \ | |
&& rm -rf /var/lib/apt/lists/* \ | |
&& echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen \ | |
&& locale-gen \ | |
&& echo "Europe/Berlin" > /etc/timezone; dpkg-reconfigure -f noninteractive tzdata \ | |
&& /usr/sbin/update-locale LANG=de_DE.UTF-8 | |
BASISIMAGE SELBER HERSTELLEN | |
============================ | |
https://github.com/docker/docker | |
Verzeichnis: contrib/mkimage-*.sh | |
Beispiele: | |
./mkimage-debootstrap {private-repo}/{namespace}/{name}:{tag} {flavour} | |
./mkimage-debootstrap private.reg.com/os/debian:8 jessie | |
AUTOMATED BUILDS | |
================ | |
Gitlab | |
https://about.gitlab.com/downloads/ | |
BATS: Bash Automated Test System | |
https://github.com/sstephenson/bats | |
VULNERABILITY SCAN | |
================== | |
CoreOS Clair | |
https://github.com/coreos/clair | |
DOCKER CONTENT TRUST | |
==================== | |
https://docs.docker.com/engine/security/trust/content_trust/ |
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
# BATS runs teardown() after each @test. | |
teardown() { | |
sudo docker rm -f memcached.service &> /dev/null || : | |
} | |
# BATS runs setup() before each @test. | |
setup() { | |
sudo docker run -d -p 11211:11211 --name memcached.service memcached-build memcached -vvv | |
memcached_ip=$(sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' memcached.service) | |
} | |
@test "memcached container is running" { | |
run sudo docker ps --format '{{ .Names }}' | |
[[ ${status} -eq 0 ]] | |
[[ ${output} =~ 'memcached.service' ]] | |
} | |
@test "memcached container has an ip address" { | |
[[ -n ${memcached_ip} ]] | |
} | |
@test "memcached responds to version command with correct version" { | |
version=$(sudo docker run --rm big.registry.brainbits.net/tools/nc echo "version" | nc ${memcached_ip} 11211) | |
[[ ${version} == *"VERSION 1.4.31"* ]] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment