Skip to content

Commit 16a0a33

Browse files
committed
Release 1.6.0
- Refactored and reduced size of all images (on-demand installation, removed not needed packages, improved ENVs/LABELs to reduce numbers of layers) - Cleanup images - Add new on-demand installation and provisioning of services (eg. postfix, ssh...) - Improved python console handling and output, also fixes dependency detection - Renamed alpine-3 to alpine (symlink to keep backward compatibility) - Add webdevops/php-official and also to webdevops/php and other images - Introduce docker-image-info for gathering information about current used image (family, distribution, version ...) - Introduce docker-service enable and docker-service disable to enable and disable services (eg. postfix, ssh ...) - Fix supervisord message about passwordless http server (unix socket) - Fix and improve tests (eg. in ipv6 environments) - Add go-replace to replace sed/awk stuff - Add webdevops/liquisoap - Add LOG_STDOUT and LOG_STDERR (redirect docker output, also possible to prevent output using /dev/null) - Set nginx log level to warn in production and info in nginx-dev images - Move ansible to webdevops/base
2 parents ebe5f17 + 39a27c1 commit 16a0a33

File tree

3,262 files changed

+32416
-16534
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,262 files changed

+32416
-16534
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ graph-full:
5757
python ./bin/console generate:graph --all --filename docker-image-full-layout.gv
5858

5959
documentation:
60-
docker run -t -i --rm -p 8080:8000 -v "$$(pwd)/documentation/docs/:/opt/docs" -e "VIRTUAL_HOST=documentation.docker" -e "VIRTUAL_PORT=8000" webdevops/sphinx sphinx-autobuild --poll -H 0.0.0.0 /opt/docs html
60+
docker run -t -i --rm -p 8000 -v "$$(pwd)/documentation/docs/:/opt/docs" -e "VIRTUAL_HOST=documentation.docker" -e "VIRTUAL_PORT=8000" webdevops/sphinx sphinx-autobuild --poll -H 0.0.0.0 /opt/docs html
6161

6262
webdevops/bootstrap:
6363
python ./bin/console docker:build --threads=auto --whitelist=webdevops/bootstrap
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
4+
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
5+
6+
apt-install software-properties-common
7+
add-apt-repository $@
8+
apt-get purge -y -f software-properties-common

baselayout/usr/local/bin/apt-install

+13-7
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
77

88
export DEBIAN_FRONTEND=noninteractive
99

10-
# Update apt cache
11-
apt-get update
10+
if [[ -f "/tmp/.apt-update" ]]; then
11+
echo "Detected prefetched 'apt-get update'"
12+
# Install packages
13+
apt-get install -y -f --no-install-recommends $*
14+
else
15+
# Update apt cache
16+
apt-get update
1217

13-
# Install packages
14-
apt-get install -y -f --no-install-recommends $*
18+
# Install packages
19+
apt-get install -y -f --no-install-recommends $*
1520

16-
# Clear files (reduce snapshot size)
17-
rm -rf /var/lib/apt/lists/*
18-
apt-get clean -y
21+
# Clear files (reduce snapshot size)
22+
rm -rf /var/lib/apt/lists/*
23+
apt-get clean -y
24+
fi

baselayout/usr/local/bin/apt-update

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
set -o pipefail # trace ERR through pipes
4+
set -o errtrace # trace ERR through 'time command' and other functions
5+
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
6+
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
7+
8+
apt-get update
9+
touch /tmp/.apt-update

baselayout/usr/local/bin/apt-upgrade

+13-7
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
77

88
export DEBIAN_FRONTEND=noninteractive
99

10-
# Update apt cache
11-
apt-get update
10+
if [[ -f "/tmp/.apt-update" ]]; then
11+
echo "Detected prefetched 'apt-get update'"
12+
# Update packages
13+
apt-get dist-upgrade -y -f
14+
else
15+
# Update apt cache
16+
apt-get update
1217

13-
# Install packages
14-
apt-get dist-upgrade -y -f
18+
# Update packages
19+
apt-get dist-upgrade -y -f
1520

16-
# Clear files (reduce snapshot size)
17-
rm -rf /var/lib/apt/lists/*
18-
apt-get clean -y
21+
# Clear files (reduce snapshot size)
22+
rm -rf /var/lib/apt/lists/*
23+
apt-get clean -y
24+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
3+
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
4+
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
5+
6+
LSB_FAMILY=$(docker-image-info family)
7+
8+
case "$LSB_FAMILY" in
9+
Debian)
10+
rm -f /tmp/.apt-update
11+
apt-get autoremove -y -f
12+
apt-get clean -y
13+
rm -rf /var/lib/apt/lists/*
14+
;;
15+
16+
RedHat)
17+
yum autoremove --assumeyes
18+
yum clean all
19+
;;
20+
21+
Alpine)
22+
find /var/lib/apk/ -mindepth 1 -delete
23+
;;
24+
25+
Arch)
26+
pacman -Sc
27+
;;
28+
29+
*)
30+
echo "ERROR: Distribution $LSB_FAMILY not supported"
31+
exit 1
32+
;;
33+
esac
34+
35+
find /tmp/ /var/log/ -mindepth 1 -delete
36+
rm -rf /root/.cache
+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/bin/sh
2+
3+
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
4+
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
5+
6+
help() {
7+
if [ -n "$1" ]; then
8+
echo "$1"
9+
echo ""
10+
fi
11+
12+
echo "Usage: $0 <argument>"
13+
echo ""
14+
echo " Application arguments:"
15+
echo " family Get distribution family"
16+
echo " dist Get distribution name"
17+
echo " dist-version Get distribution version"
18+
echo " dist-release Get distribution release"
19+
echo " dist-codename Get distribution codename"
20+
echo " lsb Get lsb informations (if available)"
21+
echo " lsb-desc Get lsb description (if available)"
22+
echo " buildtime Get buildtime of docker image"
23+
echo ""
24+
25+
exit $2
26+
27+
}
28+
29+
if [ "$#" -ne 1 ]; then
30+
help "[ERROR] Invalid argument" 1
31+
fi
32+
33+
INFO_FILE=""
34+
35+
case "$1" in
36+
dist-family|distribution-family|family)
37+
INFO_FILE=/opt/docker/etc/.registry/image_info_distribution_family
38+
;;
39+
40+
dist|distribution)
41+
INFO_FILE=/opt/docker/etc/.registry/image_info_distribution
42+
;;
43+
44+
dist-version|distribution-version)
45+
INFO_FILE=/opt/docker/etc/.registry/image_info_distribution_version
46+
;;
47+
48+
dist-release|distribution-release)
49+
INFO_FILE=/opt/docker/etc/.registry/image_info_lsb_release
50+
;;
51+
52+
dist-codename|distribution-codename)
53+
INFO_FILE=/opt/docker/etc/.registry/image_info_lsb_codename
54+
;;
55+
56+
lsb)
57+
INFO_FILE=/opt/docker/etc/.registry/image_info_lsb
58+
;;
59+
60+
lsb-desc|lsb-description)
61+
INFO_FILE=/opt/docker/etc/.registry/image_info_lsb_description
62+
;;
63+
64+
buildtime)
65+
INFO_FILE=/opt/docker/etc/.registry/image_info_buildtime
66+
;;
67+
68+
help)
69+
help "" 0
70+
;;
71+
72+
*)
73+
help "[ERROR] Invalid argument" 1
74+
;;
75+
esac
76+
77+
if [ -n "$INFO_FILE" ]; then
78+
if [ -f "$INFO_FILE" ]; then
79+
cat -- "$INFO_FILE"
80+
else
81+
echo "[ERROR] Infomation file $INFO_FILE not found!"
82+
echo " Please run generate-dockerimage-info on docker image creation!"
83+
exit 2
84+
fi
85+
else
86+
help "" 1
87+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#!/bin/sh
2+
3+
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
4+
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
5+
6+
LSB_FAMILY=""
7+
8+
#############################
9+
# Distribution detection
10+
#############################
11+
12+
if [ -x "/usr/bin/apt-get" ]; then
13+
# Debian family
14+
LSB_FAMILY="Debian"
15+
16+
elif [ -x "/bin/yum" ]; then
17+
# RedHat family
18+
LSB_FAMILY="RedHat"
19+
20+
elif [ -x "/sbin/apk" ]; then
21+
# Alpine family
22+
LSB_FAMILY="Alpine"
23+
24+
elif [ -f "/etc/arch-release" ]; then
25+
# Alpine family
26+
LSB_FAMILY="Arch"
27+
28+
else
29+
# Unknown
30+
echo "ERROR: Distribution detection failed"
31+
exit 1
32+
fi
33+
34+
#############################
35+
# Install
36+
#############################
37+
38+
case "$LSB_FAMILY" in
39+
Debian)
40+
apt-install lsb-release
41+
;;
42+
43+
RedHat)
44+
yum-install redhat-lsb-core
45+
;;
46+
esac
47+
48+
#############################
49+
# Set distribution information
50+
#############################
51+
52+
echo "Detected $LSB_FAMILY"
53+
54+
mkdir -p /opt/docker/etc/.registry/
55+
echo "$LSB_FAMILY" > /opt/docker/etc/.registry/image_info_distribution_family
56+
echo "$LSB_FAMILY" > /opt/docker/etc/.registry/image_info_distribution
57+
date +%s >/opt/docker/etc/.registry/image_info_buildtime
58+
59+
# Create all files
60+
touch /opt/docker/etc/.registry/image_info_distribution_version
61+
touch /opt/docker/etc/.registry/image_info_lsb
62+
touch /opt/docker/etc/.registry/image_info_lsb_description
63+
touch /opt/docker/etc/.registry/image_info_lsb_release
64+
touch /opt/docker/etc/.registry/image_info_lsb_codename
65+
66+
# Collect distribution specific informations
67+
case "$LSB_FAMILY" in
68+
Debian|RedHat)
69+
lsb_release -i -s > /opt/docker/etc/.registry/image_info_distribution
70+
lsb_release -r -s > /opt/docker/etc/.registry/image_info_distribution_version
71+
lsb_release -a > /opt/docker/etc/.registry/image_info_lsb
72+
lsb_release -d -s > /opt/docker/etc/.registry/image_info_lsb_description
73+
lsb_release -r -s > /opt/docker/etc/.registry/image_info_lsb_release
74+
lsb_release -c -s > /opt/docker/etc/.registry/image_info_lsb_codename
75+
;;
76+
77+
Alpine)
78+
cat /etc/alpine-release > /opt/docker/etc/.registry/image_info_distribution_version
79+
;;
80+
esac
81+
82+
83+
#############################
84+
# Uninstall
85+
#############################
86+
87+
case "$LSB_FAMILY" in
88+
Debian)
89+
apt-get purge -y -f lsb-release
90+
;;
91+
92+
RedHat)
93+
yum erase --assumeyes redhat-lsb-core
94+
yum autoremove --assumeyes
95+
;;
96+
esac

baselayout/usr/local/bin/generate-locales

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
#!/bin/bash
22

3-
set -o pipefail # trace ERR through pipes
4-
set -o errtrace # trace ERR through 'time command' and other functions
3+
set -o pipefail ## trace ERR through pipes
4+
set -o errtrace ## trace ERR through 'time command' and other functions
55
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
66
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
77

8+
IMAGE_DISTRIBUTION_FAMILY=$(docker-image-info family)
9+
IMAGE_DISTRIBUTION=$(docker-image-info distribution)
10+
IMAGE_DISTRIBUTION_VERSION=$(docker-image-info distribution-version)
811

912
#######################################
1013
## Debian
1114
#######################################
1215

13-
if [[ "$(lsb_release -i -s)" == "Debian" ]]; then
16+
if [[ "$IMAGE_DISTRIBUTION" == "Debian" ]]; then
1417
/usr/local/bin/apt-install locales-all
1518
fi
1619

1720
#######################################
1821
## Ubuntu
1922
#######################################
2023

21-
if [[ "$(lsb_release -i -s)" == "Ubuntu" ]]; then
22-
if [[ "$(lsb_release -r -s | cut -f 1 -d .)" -ge "16" ]]; then
24+
if [[ "$IMAGE_DISTRIBUTION" == "Ubuntu" ]]; then
25+
if [[ "$(echo $IMAGE_DISTRIBUTION_VERSION| cut -f 1 -d .)" -ge "16" ]]; then
2326
# Ubuntu 16.04 or later
2427
/usr/local/bin/apt-install locales-all
2528
else
@@ -33,12 +36,12 @@ fi
3336
## RedHat family
3437
#######################################
3538

36-
function localedefdebug() {
37-
echo $*
38-
localedef "$@"
39-
}
39+
if [[ "$IMAGE_DISTRIBUTION_FAMILY" == "RedHat" ]]; then
4040

41-
if [[ -f /etc/redhat-release ]]; then
41+
function localedefdebug() {
42+
echo $*
43+
localedef "$@"
44+
}
4245

4346
# Failing locales
4447
## && localedefdebug -c -i bo_CN -f UTF-8 bo_CN.utf8 \

bin/webdevops/DockerfileUtility.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ def parse_docker_info_from_path(path):
7979
image_name = (image_name_info['image'] if 'image' in image_name_info else '')
8080
image_tag = (image_name_info['tag'] if 'tag' in image_name_info else '')
8181

82+
image_is_duplicate = False
83+
8284
# check if path is linked
8385
if os.path.islink(os.path.dirname(path)):
8486
linked_image_name_info = ([m.groupdict() for m in path_regex.finditer(os.path.realpath(path))])[0]
@@ -88,6 +90,7 @@ def parse_docker_info_from_path(path):
8890
linked_image_tag = (linked_image_name_info['tag'] if 'tag' in linked_image_name_info else '')
8991

9092
image_from = image_prefix + linked_image_repository + '/' + linked_image_name + ':' + linked_image_tag
93+
image_is_duplicate = True
9194
else:
9295
image_from = parse_dockerfile_from_statement(path)
9396

@@ -97,7 +100,8 @@ def parse_docker_info_from_path(path):
97100
'tag': image_tag,
98101
'repository': image_prefix + image_repository,
99102
'imageName': image_name,
100-
'from': image_from
103+
'from': image_from,
104+
'duplicate': image_is_duplicate
101105
}
102106
return imageInfo
103107

bin/webdevops/command/BaseCommand.py

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import multiprocessing
2424
from cleo import Command
2525
from webdevops import Configuration
26+
from ..doit.DoitReporter import DoitReporter
2627

2728
class BaseCommand(Command):
2829
configuration = False
@@ -86,6 +87,8 @@ def startup(self):
8687

8788
if 'dryRun' in self.configuration and self.configuration.get('dryRun'):
8889
options.append('dry-run')
90+
DoitReporter.simulation_mode = True
91+
8992

9093
print 'Executing %s (%s)' % (self.name, ', '.join(options))
9194
print ''

0 commit comments

Comments
 (0)