Skip to content

masakazuwatanabe/docker-entrypoint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

docker-entrypoint (entrypoint.py)

easy and simple docker entrypoint of Python. pid1 init script of single python file.

requiemnt

Pyton 2.7 or letter.

if you want to use is yaml.

PyYAML

using example

entrypoint.sh

#!/bin/sh
set -e
if [ $# -ne 0 ]; then
    exec "$@"
fi
exec /entrypoint.py

entrypoint.yml

service:
  rsyslog:
    type: service
    pid: /var/run/syslogd.pid
    start: "service rsyslog restart"
    stop: "service rsyslog stop"
  cron:
    type: background
    pid: /var/run/crond.pid
    start: "/usr/sbin/crond"
stdout:
  - /var/log/cron
  - /var/log/messages
start:
  - rsyslog
  - cron
stop:
  - cron
  - rsyslog

Dockerfile

FROM centos:6
RUN yum -y install PyTAML rsyslog cronie

COPY entrypoint.sh /
COPY entrypoint.py /
COPY entrypoint.yml /
RUN chmod +x /entrypoint.sh /entrypoint.py

ENTRYPOINT ["/entrypoint.sh"]
CMD []

more effective

entrypoint.yml

service:
  rsyslog:
    type: service
    pid: /var/run/syslogd.pid
    start: "service rsyslog restart"
    stop: "service rsyslog stop"
    monitor_interval: 3
    monitor_delay: 3
    restart: always
  cron:
    type: background
    pid: /var/run/crond.pid
    start: "/usr/sbin/crond"
    monitor_interval: 3
    monitor_delay: 3
    restart: always
  redis:
    type foreground
    start:
      - "/usr/sbin/redis-server"
    stop_signal: SIGTERM
    restart: always
stdout:
  - /var/log/cron
  - /var/log/messages
start:
  - rsyslog
  - cron
  - redis
stop:
  - redis
  - cron
  - rsyslog

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages