FROM alpine:3

RUN apk update
RUN apk --no-cache add php8 php8-openssl php8-pdo php8-pdo_mysql    \
                       php8-pdo_sqlite php8-pdo_pgsql php8-mbstring \
                       php8-phar php8-curl php8-dom php8-xml        \
                       php8-xmlwriter php8-tokenizer                \
                       zip unzip curl sqlite

RUN ln -s /usr/bin/php8 /usr/bin/php
RUN curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer

WORKDIR /lumen

COPY composer.json .
COPY composer.lock .

RUN composer install --no-ansi --no-dev --no-interaction --no-plugins \
                     --no-progress --no-scripts --optimize-autoloader

COPY . /lumen

ENTRYPOINT ["php", "-S", "0.0.0.0:8080", "-t", "public"]
