kimai-container/Containerfile

61 lines
2 KiB
Text
Raw Normal View History

2023-02-02 17:29:27 +00:00
# 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"]