Created
May 11, 2023 02:09
-
-
Save Jspascal/48c8b4c33c816be4394c8c6ae5bba1ac to your computer and use it in GitHub Desktop.
Laravel application Dockerfile (Laravel version 10, php version 8.1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dockerfile for Laravel app built by Joseph Nomo | |
## | |
# FIRST SECTION //PHP\\ (1) | |
# | |
# Installing php and it's extensions | |
## | |
FROM php:8.1 | |
RUN apt-get update && apt-get install -y \ | |
curl \ | |
libonig-dev \ | |
libzip-dev \ | |
unzip | |
RUN docker-php-ext-install mysqli pdo_mysql | |
RUN docker-php-ext-install mbstring | |
RUN docker-php-ext-install zip | |
## END FIRST SECTION (1) | |
## | |
# SECOND SECTION //CONFIGURATION\\ (2) | |
# | |
# Installing composer - setting working dir - copy local files and change folder ownership | |
## | |
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | |
WORKDIR /var/www/html | |
COPY . . | |
RUN composer install --no-interaction | |
RUN chgrp -R www-data storage bootstrap/cache | |
RUN chmod -R ug+rwx storage bootstrap/cache | |
## END SECOND SECTION (2) | |
## | |
# THIRD SECTION //RUN\\ (3) | |
# | |
# Expose desired ip and run the app on it | |
## | |
EXPOSE 8000 | |
CMD php artisan serve --host=0.0.0.0 --port=8000 | |
## END THIRD SECTION (3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment