This commit is contained in:
Cat /dev/Nulo 2023-02-02 14:29:27 -03:00
commit 50773d504a
22 changed files with 126 additions and 0 deletions

60
Containerfile Normal file
View file

@ -0,0 +1,60 @@
# Based on https://github.com/tobybatch/kimai2/blob/main/Dockerfile
###########################
# Shared tools
###########################
FROM docker.io/alpine:3.17
ARG S6_OVERLAY_VERSION=3.1.3.0
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
RUN apk add --no-cache nginx composer tzdata \
php81 php81-fpm mariadb \
php81-gd php81-intl php81-json php81-mbstring php81-pdo php81-xsl php81-zip \
php81-tokenizer php81-xml php81-simplexml php81-fileinfo php81-xmlwriter php81-xmlreader \
php81-session \
php81-pdo_mysql
RUN \
apk add --no-cache curl bash && \
curl -sS https://get.symfony.com/cli/installer | bash
ARG KIMAI="main"
RUN \
apk add --no-cache git && \
git clone --depth 1 --branch ${KIMAI} https://github.com/kimai/kimai.git /opt/kimai && \
chown -R nobody:nobody /opt/kimai
RUN sed -i 's/memory_limit = 128M/memory_limit = 2G/' /etc/php81/php.ini
RUN cd /opt/kimai && \
composer --no-ansi install --working-dir=/opt/kimai --optimize-autoloader && \
composer --no-ansi clearcache
ENV PATH /opt/kimai/bin:$PATH
ENV KIMAI=${KIMAI}
ENV DATABASE_URL=mysql://root@localhost/kimai2?charset=utf8&serverVersion=5.7
ENV APP_ENV=prod
ENV APP_SECRET=change_this_to_something_unique
RUN echo "DATABASE_URL='${DATABASE_URL}'" > /opt/kimai/.env && \
echo "APP_ENV='${APP_ENV}'" >> /opt/kimai/.env
ARG TZ=America/Argentina/Buenos_Aires
ENV TZ=${TZ}
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone
# copy startup script & DB checking script
#COPY assets/startup.sh /startup.sh
#COPY assets/self-test.sh /self-test.sh
#COPY assets/dbtest.php /dbtest.php
ADD kimai.conf /etc/nginx/http.d/kimai.conf
RUN rm /etc/nginx/http.d/default.conf
ADD s6-rc.d /etc/s6-overlay/s6-rc.d/
ENTRYPOINT ["/init"]

40
kimai.conf Normal file
View file

@ -0,0 +1,40 @@
# https://www.kimai.org/documentation/webserver-configuration.html
server {
listen 80;
root /opt/kimai/public;
index index.php;
access_log off;
log_not_found off;
location ~ /\.ht {
deny all;
}
location / {
try_files $uri /index.php$is_args$args;
}
location ~ ^/index\.php(/|$) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# You can use the document root directly:
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# But this is not working in every situation. When you are using symlinks to link the document
# root to the current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP FPM.
# Otherwise, PHP's OPcache may not properly detect changes to your PHP files
# (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 for more information).
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# Activate this if you run Kimai alone or inside a VirtualHost, otherwise this example might break other PHP apps
# fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/..:/tmp/";
internal;
}
location ~ \.php$ {
return 404;
}
}

1
readme.md Normal file
View file

@ -0,0 +1 @@
container de [kimai](https://kimai.org/). no funciona todavía, y probablemente nunca.

10
s6-rc.d/kimai-install/script.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
while test ! -S /run/mysqld/mysqld.sock; do sleep 1; done
if test "$APP_SECRET" = change_this_to_something_unique; then
echo "No APP_SECRET"
exit 1
fi
echo "APP_SECRET='$APP_SECRET'" >> /opt/kimai/.env
su nobody -c 'console kimai:install --no-interaction' || exit $?
su nobody -c 'console kimai:update --no-interaction' || exit $?

View file

@ -0,0 +1 @@
oneshot

2
s6-rc.d/kimai-install/up Executable file
View file

@ -0,0 +1,2 @@
foreground { echo "Calling /etc/s6-overlay/s6-rc.d/kimai-install/script.sh..." }
/etc/s6-overlay/s6-rc.d/kimai-install/script.sh

View file

5
s6-rc.d/mariadb/run Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
mysql_install_db --user=mysql --datadir=/var/lib/mysql
exec /usr/bin/mysqld_safe --syslog

1
s6-rc.d/mariadb/type Normal file
View file

@ -0,0 +1 @@
longrun

View file

2
s6-rc.d/nginx/run Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
exec nginx -g "daemon off;"

1
s6-rc.d/nginx/type Normal file
View file

@ -0,0 +1 @@
longrun

View file

2
s6-rc.d/php-fpm/run Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
exec php-fpm81 --nodaemonize

1
s6-rc.d/php-fpm/type Normal file
View file

@ -0,0 +1 @@
longrun

View file

View file

View file

View file