entrypoint/: initialize /data

refs #2
This commit is contained in:
Alexander A. Klimov 2020-06-24 15:29:58 +02:00
parent 754762bcb7
commit 8de79895d0
2 changed files with 12 additions and 1 deletions

View File

@ -27,6 +27,8 @@ EXPOSE 8080
RUN ["chmod", "o+x", "/var/log/apache2"]
RUN ["chown", "www-data:www-data", "/var/run/apache2"]
RUN ["install", "-o", "www-data", "-g", "www-data", "-d", "/etc/icingaweb2"]
RUN ["ln", "-vs", "/data/etc/icingaweb2", "/etc/icingaweb2"]
RUN ["install", "-o", "www-data", "-g", "www-data", "-d", "/data"]
VOLUME ["/data"]
ENTRYPOINT ["/entrypoint"]

View File

@ -23,6 +23,15 @@ func entrypoint() error {
return nil
}
if os.Getpid() == 1 {
logf("info", "Initializing /data as we're the init process")
logf("debug", `Creating "/data/etc/icingaweb2"`)
if errMA := os.MkdirAll("/data/etc/icingaweb2", 0750); errMA != nil {
return errMA
}
}
path := os.Args[1]
if filepath.Base(path) == path {
logf("info", "Looking up %#v in $PATH", path)