Skip to content

Commit

Permalink
Merge branch 'release-0.2.6' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
BertrandGouny committed Nov 8, 2016
2 parents f71935b + 1b077b4 commit ce924c7
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 33 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.2.6
- Add to the 'run' tool option --dont-touch-etc-hosts Don't add in /etc/hosts a line with the container ip and $HOSTNAME environment variable value.
- Fix wait-process script

## 0.2.5
- Fix is_runit_installed check /usr/bin/sv instead of /sbin/runit #6
- Upgrade cfssl 1.2.0
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME = osixia/light-baseimage
VERSION = 0.2.5
VERSION = 0.2.6

.PHONY: all build build-nocache test tag_latest release

Expand Down
49 changes: 31 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

[hub]: https://hub.docker.com/r/osixia/light-baseimage/

Latest release: 0.2.5 - [Changelog](CHANGELOG.md)
Latest release: 0.2.6 - [Changelog](CHANGELOG.md)
| [Docker Hub](https://hub.docker.com/r/osixia/light-baseimage/) 

A Debian Jessie based docker image to build reliable image quickly. This image provide a simple opinionated solution to build multiple or single process image with minimum of layers and an optimized build.
Expand Down Expand Up @@ -143,7 +143,7 @@ In the Dockerfile we are going to:

# Use osixia/light-baseimage
# https://github.com/osixia/docker-light-baseimage
FROM osixia/light-baseimage:0.2.5
FROM osixia/light-baseimage:0.2.6
MAINTAINER Your Name <[email protected]>

# Download nginx from apt-get and clean apt-get files
Expand Down Expand Up @@ -386,7 +386,7 @@ In the Dockerfile we are going to:

# Use osixia/light-baseimage
# https://github.com/osixia/docker-light-baseimage
FROM osixia/light-baseimage:0.2.5
FROM osixia/light-baseimage:0.2.6
MAINTAINER Your Name <[email protected]>

# Install multiple process stack, nginx and php5-fpm and clean apt-get files
Expand Down Expand Up @@ -519,6 +519,7 @@ Single process images:
- [osixia/tinc](https://github.com/osixia/docker-tinc)
- [osixia/registry-ldap-auth](https://github.com/osixia/docker-registry-ldap-auth)
- [osixia/cfssl-multirootca](https://github.com/osixia/docker-cfssl-multirootca)
- [osixia/backup](https://github.com/osixia/docker-backup)
- [osixia/backup-manager](https://github.com/osixia/docker-backup-manager)
- [osixia/mmc-agent](https://github.com/osixia/docker-mmc-agent)

Expand All @@ -527,14 +528,18 @@ Multiple process images:
- [osixia/mariadb](https://github.com/osixia/docker-mariadb)
- [osixia/wordpress](https://github.com/osixia/docker-wordpress)
- [osixia/roundcube](https://github.com/osixia/docker-roundcube)
- [osixia/piwik](https://github.com/osixia/docker-piwik)
- [osixia/phpMyAdmin](https://github.com/osixia/docker-phpMyAdmin)
- [osixia/phpLDAPadmin](https://github.com/osixia/docker-phpLDAPadmin)
- [osixia/kubernetes-reverseproxy](https://github.com/osixia/kubernetes-reverseproxy)
- [osixia/keepalived-confd](https://github.com/osixia/docker-keepalived-confd)
- [osixia/tinc-etcd](https://github.com/osixia/docker-tinc-etcd)
- [osixia/postfix-gateway-confd](https://github.com/osixia/docker-postfix-gateway-confd)
- [osixia/mmc-mail](https://github.com/osixia/docker-mmc-mail)
- [osixia/mmc-web](https://github.com/osixia/docker-mmc-web)

Image adding light-baseimage tools to an existing image
- [osixia/gitlab](https://github.com/osixia/docker-gitlab)

Send me a message to add your image in this list.

## Image Assets
Expand Down Expand Up @@ -579,7 +584,7 @@ Here simple Dockerfile example how to add a service-available to an image:

# Use osixia/light-baseimage
# https://github.com/osixia/docker-light-baseimage
FROM osixia/light-baseimage:0.2.5
FROM osixia/light-baseimage:0.2.6
MAINTAINER Your Name <[email protected]>

# Add cfssl and cron service-available
Expand Down Expand Up @@ -649,10 +654,11 @@ What it does:

*Run tool* takes several options, to list them:

docker run osixia/light-baseimage:0.2.5 --help
usage: run [-h] [-e] [-s] [-p] [-f] [-o {startup,process,finish}] [-c COMMAND]
[-k] [--copy-service] [--wait-first-startup]
[--wait-state FILENAME] [--keep-startup-env] [--keepalive]
docker run osixia/light-baseimage:0.2.6 --help
usage: run [-h] [-e] [-s] [-p] [-f] [-o {startup,process,finish}]
[-c COMMAND [WHEN={startup,process,finish} ...]] [-k]
[--wait-state FILENAME] [--wait-first-startup] [--keep-startup-env]
[--copy-service] [--dont-touch-etc-hosts] [--keepalive]
[--keepalive-force] [-l {none,error,warning,info,debug,trace}]
[MAIN_COMMAND [MAIN_COMMAND ...]]

Expand All @@ -675,27 +681,34 @@ What it does:
Skip running container finish file(s).
-o {startup,process,finish}, --run-only {startup,process,finish}
Run only this file type and ignore others.
-c COMMAND, --cmd COMMAND
Run this command before startup files.
-c COMMAND [WHEN={startup,process,finish} ...], --cmd COMMAND [WHEN={startup,process,finish} ...]
Run this command before WHEN file(s). Default before
startup file(s).
-k, --no-kill-all-on-exit
Don't kill all processes on the system upon exiting.
--copy-service Copy /container/service to /container/run/service
--wait-first-startup Wait until the first startup is done before starting.
Usefull when 2 containers share /container/run
directory via volume.
--wait-state FILENAME
Wait until the container state file exists in
/container/run/state directory before starting.
Usefull when 2 containers share /container/run
directory via volume.
--wait-first-startup Wait until the first startup is done before starting.
Usefull when 2 containers share /container/run
directory via volume.
--keep-startup-env Don't remove ('.startup.yaml', '.startup.json')
environment files after startup scripts.
--copy-service Copy /container/service to /container/run/service.
Help to fix docker mounted files problems.
--dont-touch-etc-hosts
Don't add in /etc/hosts a line with the container ip
and $HOSTNAME environment variable value.
--keepalive Keep alive container if all startup files and process
exited without error.
--keepalive-force Keep alive container in all circonstancies.
-l {none,error,warning,info,debug,trace}, --loglevel {none,error,warning,info,debug,trace}
Log level (default: info)

Osixia! Light Baseimage: https://github.com/osixia/docker-light-baseimage


##### Run directory setup
*Run tool* will create if they not exists the following directories:
Expand Down Expand Up @@ -752,7 +765,7 @@ If a main command is set for example:
If a main command is set *run tool* launch it otherwise bash is launched.
Example:

docker run -it osixia/light-baseimage:0.2.5
docker run -it osixia/light-baseimage:0.2.6


##### Extra environment variables
Expand Down Expand Up @@ -828,8 +841,8 @@ Note this yaml definition:

Can also be set by command line converted in python or json:

docker run -it --env FRUITS="#PYTHON2BASH:['orange','apple']" osixia/light-baseimage:0.2.5 printenv
docker run -it --env FRUITS="#JSON2BASH:[\"orange\",\"apple\"]" osixia/light-baseimage:0.2.5 printenv
docker run -it --env FRUITS="#PYTHON2BASH:['orange','apple']" osixia/light-baseimage:0.2.6 printenv
docker run -it --env FRUITS="#JSON2BASH:[\"orange\",\"apple\"]" osixia/light-baseimage:0.2.6 printenv

### Tests

Expand Down
2 changes: 1 addition & 1 deletion example/multiple-process-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Use osixia/light-baseimage
# https://github.com/osixia/docker-light-baseimage
FROM osixia/light-baseimage:0.2.5
FROM osixia/light-baseimage:0.2.6
MAINTAINER Your Name <[email protected]>

# Install multiple process stack, nginx and php5-fpm and clean apt-get files
Expand Down
2 changes: 1 addition & 1 deletion example/single-process-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Use osixia/light-baseimage
# https://github.com/osixia/docker-light-baseimage
FROM osixia/light-baseimage:0.2.5
FROM osixia/light-baseimage:0.2.6
MAINTAINER Your Name <[email protected]>

# Download nginx from apt-get and clean apt-get files
Expand Down
22 changes: 13 additions & 9 deletions image/tool/run
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,8 @@ def set_env_hostname_to_etc_hosts():
with open('/etc/hostname', 'r') as f:
etc_hostname = f.readline().rstrip()

ip_address = socket.gethostbyname(etc_hostname)

if os.environ["HOSTNAME"] != etc_hostname:
ip_address = socket.gethostbyname(etc_hostname)
with open("/etc/hosts", "a") as myfile:
myfile.write(ip_address+" "+os.environ["HOSTNAME"]+"\n")
except:
Expand Down Expand Up @@ -768,7 +767,9 @@ def main(args):
info(ENVIRONMENT_LOG_LEVEL_KEY + " = " + xstr(log_level) + " (" + log_level_switcher_inv.get(log_level) + ")")
state_reset_startup_done()

set_env_hostname_to_etc_hosts()
if args.set_env_hostname_to_etc_hosts:
set_env_hostname_to_etc_hosts()

wait_states(args.wait_states)
setup_run_directories(args)

Expand Down Expand Up @@ -823,18 +824,21 @@ parser.add_argument('-c', '--cmd', metavar=('COMMAND', 'WHEN={startup,process,fi
parser.add_argument('-k', '--no-kill-all-on-exit', dest = 'kill_all_on_exit',
action = 'store_const', const = False, default = True,
help = 'Don\'t kill all processes on the system upon exiting.')
parser.add_argument('--copy-service', dest = 'copy_service',
action = 'store_const', const = True, default = False,
help = 'Copy '+IMPORT_SERVICE_DIR+' to '+RUN_SERVICE_DIR)
parser.add_argument('--wait-first-startup', dest = 'wait_first_startup',
action = 'store_const', const = True, default = False,
help = 'Wait until the first startup is done before starting. Usefull when 2 containers share '+RUN_DIR+' directory via volume.')
parser.add_argument('--wait-state', metavar = 'FILENAME', dest = 'wait_states', type = str,
action = 'append', default=[],
help = 'Wait until the container state file exists in '+RUN_STATE_DIR+' directory before starting. Usefull when 2 containers share '+RUN_DIR+' directory via volume.')
parser.add_argument('--wait-first-startup', dest = 'wait_first_startup',
action = 'store_const', const = True, default = False,
help = 'Wait until the first startup is done before starting. Usefull when 2 containers share '+RUN_DIR+' directory via volume.')
parser.add_argument('--keep-startup-env', dest = 'keep_startup_env',
action = 'store_const', const = True, default = False,
help = 'Don\'t remove ' + xstr(ENV_FILES_STARTUP_EXTENSIONS) + ' environment files after startup scripts.')
parser.add_argument('--copy-service', dest = 'copy_service',
action = 'store_const', const = True, default = False,
help = 'Copy '+IMPORT_SERVICE_DIR+' to '+RUN_SERVICE_DIR+'. Help to fix docker mounted files problems.')
parser.add_argument('--dont-touch-etc-hosts', dest = 'set_env_hostname_to_etc_hosts',
action = 'store_const', const = False, default = True,
help = 'Don\'t add in /etc/hosts a line with the container ip and $HOSTNAME environment variable value.')
parser.add_argument('--keepalive', dest = 'keepalive',
action = 'store_const', const = True, default = False,
help = 'Keep alive container if all startup files and process exited without error.')
Expand Down
4 changes: 1 addition & 3 deletions image/tool/wait-process
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/bin/sh -e

. /container/run/environment.sh

# wait startup to finish
while ! test -f ${CONTAINER_STATE_DIR}/startup-done
while ! test -f /container/run/state/startup-done
do
sleep 0.5
done
Expand Down

0 comments on commit ce924c7

Please sign in to comment.