Shahhoud

Dockerfile

Jun 14th, 2022 (edited)
128
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.62 KB | None
  1. FROM php:8.1-fpm
  2. # Copy composer.lock and composer.json
  3. COPY composer.lock composer.json /var/www/
  4.  
  5. # Set working directory
  6. WORKDIR /var/www
  7.  
  8. # Install dependencies
  9. RUN apt-get update && apt-get install -y \
  10.     wget \
  11.     build-essential \
  12.     libpng-dev \
  13.     libjpeg62-turbo-dev \
  14.     libfreetype6-dev \
  15.     locales \
  16.     zip \
  17.     jpegoptim optipng pngquant gifsicle \
  18.     vim \
  19.     unzip \
  20.     git \
  21.     curl \
  22.     libicu-dev \
  23.     libonig-dev \
  24.     libzip-dev
  25.  
  26. # Clear cache
  27. RUN apt-get clean && rm -rf /var/lib/apt/lists/*
  28.  
  29. # Install extensions
  30. RUN docker-php-ext-install pdo_mysql \
  31. && docker-php-ext-install mbstring \
  32. && docker-php-ext-install zip \
  33. && docker-php-ext-install exif \
  34. && docker-php-ext-install pcntl \
  35. && docker-php-ext-configure gd --with-freetype --with-jpeg \
  36. && docker-php-ext-install gd \
  37. && docker-php-ext-configure intl \
  38. && docker-php-ext-install intl \
  39. && pecl install -o -f redis \
  40. && rm -rf /tmp/pear \
  41. && docker-php-ext-enable redis
  42.  
  43.  
  44. RUN mkdir /opt/oracle
  45. # Install Oracle Instantclient
  46. RUN wget https://download.oracle.com/otn_software/linux/instantclient/216000/instantclient-basic-linux.x64-21.6.0.0.0dbru.zip \
  47. && wget https://download.oracle.com/otn_software/linux/instantclient/216000/instantclient-sdk-linux.x64-21.6.0.0.0dbru.zip \
  48. && wget https://download.oracle.com/otn_software/linux/instantclient/216000/instantclient-sqlplus-linux.x64-21.6.0.0.0dbru.zip \
  49. && unzip instantclient-basic-linux.x64-21.6.0.0.0dbru.zip -d /opt/oracle \
  50. && unzip instantclient-sdk-linux.x64-21.6.0.0.0dbru.zip -d /opt/oracle \
  51. && unzip instantclient-sqlplus-linux.x64-21.6.0.0.0dbru.zip -d /opt/oracle \
  52. && rm -rf *.zip \
  53. && mv /opt/oracle/instantclient_21_6 /opt/oracle/instantclient
  54.  
  55. #add oracle instantclient path to environment
  56. ENV LD_LIBRARY_PATH /opt/oracle/instantclient/
  57. RUN ldconfig
  58.  
  59. # Install Oracle extensions
  60. RUN docker-php-ext-configure pdo_oci --with-pdo-oci=instantclient,/opt/oracle/instantclient,21.1 \
  61. && echo 'instantclient,/opt/oracle/instantclient/' | pecl install oci8 \
  62. && docker-php-ext-install \
  63.         pdo_oci \
  64. && docker-php-ext-enable \
  65.         oci8
  66.  
  67. # Install composer
  68. RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  69.  
  70. # Add user for laravel application
  71. RUN groupadd -g 1000 www
  72. RUN useradd -u 1000 -ms /bin/bash -g www www
  73.  
  74. # Copy existing application directory contents
  75. COPY . /var/www
  76.  
  77. # Copy existing application directory permissions
  78. COPY --chown=www:www . /var/www
  79.  
  80. # Change current user to www
  81. USER www
  82.  
  83. # Expose port 9000 and start php-fpm server
  84. EXPOSE 9000
  85. CMD ["php-fpm"]
  86.  
RAW Paste Data Copied