@BEERBUDDHA - I think what @markotitel and I are suggesting is to try it (just as a quick test) on another environment (outside of docker) just to check if docker is contributing to the problem. Not to replace your whole production setup :-) The reason I was suggesting running it outside of AWS was again, just to check another possible reason it could be going slow. AWS is much more complicated animal than, say, Digital Ocean - there are all sorts of things that can be combined that could be having a side-effect.
[Edit - I just saw your new reply] If you add a route to your code that does something like :
Route::get('/whatever', function () {
phpinfo();
});
then it should tell you if opcache is enabled and what the settings are (there is a section labelled 'Zend OPcache'). [Edit - You probably want to enable the file caching in your opcache setting, try something like :
opcache.validate_timestamps=0
opcache.memory_consumption=128 # MB, adjust to your needs
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000 # Adjust to your needs
opcache.max_wasted_percentage=10 # Adjust to your needs
Maybe also start up another container on a different port using the base php image. I usually use php:7.2-apache so I don't have to bother setting up fpm/nginx as well for instance. Just do a laravel new test-project and build it inside the container and see how many requests it can handle. Something like this should do it :
FROM php:7.2-apache
RUN apt-get update && \
apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev libgmp-dev libldap2-dev netcat sqlite3 libsqlite3-dev && \
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \
docker-php-ext-install gd pdo pdo_mysql pdo_sqlite zip gmp bcmath pcntl sysvmsg exif \
&& a2enmod rewrite
COPY vhost.conf /etc/apache2/sites-available/000-default.conf
EXPOSE 80
COPY . /var/www/html
RUN chown -R www-data:www-data /var/www/html/storage
RUN chown -R www-data:www-data /var/www/html/bootstrap/cache
CMD ["apache2-foreground"]
// vhost.conf
<VirtualHost *:80>
DocumentRoot /var/www/html/public
<Directory "/var/www/html/public">
AllowOverride all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>