FROM dunglas/frankenphp:static-builder

# Install necessary PHP extensions and MySQL client
RUN apk add --no-cache \
    php83-pdo \
    php83-pdo_mysql \
    mysql-client

# Copy your app
WORKDIR /go/src/app/dist/app
COPY . .

# Remove the tests and other unneeded files to save space
RUN rm -Rf tests/



# Install the dependencies
RUN composer install --ignore-platform-reqs  -a

# Generate app key
RUN php artisan key:generate

# Build the static binary
WORKDIR /go/src/app/
RUN EMBED=dist/app/ ./build-static.sh
