Skip to content

Instantly share code, notes, and snippets.

@trapd00r
Created February 3, 2024 14:41
Show Gist options
  • Save trapd00r/77b1a1b41f6c3b3701e9d1a4c22b9ff0 to your computer and use it in GitHub Desktop.
Save trapd00r/77b1a1b41f6c3b3701e9d1a4c22b9ff0 to your computer and use it in GitHub Desktop.
Dockerfile.php-fpm
version: '3.9'
services:
web:
image: nginx:latest
ports:
- '8084:80'
volumes:
- ./src:/var/www/html
- ./default.conf:/etc/nginx/conf.d/default.conf
links:
- php-fpm
php-fpm:
build:
context: .
dockerfile: Dockerfile.php-fpm
volumes:
- ./src:/var/www/html
- ./php.ini:/usr/local/etc/php/php.ini
- ./docker-fpm.ini:/usr/local/etc/php/conf.d/docker-fpm.ini
FROM php:8-fpm
# Install system dependencies (if any)
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libpq-dev \
&& docker-php-ext-install -j$(nproc) iconv \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd
# Install MySQL PDO extension
RUN docker-php-ext-install pdo_mysql
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Set the working directory
WORKDIR /var/www
# Install PHP dependencies
RUN composer install --no-dev --optimize-autoloader
# Copy custom PHP configuration files (if you have them)
COPY ./php.ini /usr/local/etc/php/php.ini
COPY ./docker-fpm.ini /usr/local/etc/php/conf.d/docker-fpm.ini
└[fantomen]> tree src
src
├── config.php
├── Database
│   └── Connection.php
├── Info
│   ├── Album.php
│   ├── Artist.php
│   └── PlexAPI.php
├── Japh
│   └── API.php
├── routeme.php
├── Scrobble
│   ├── fakeScrobbleFetcher.php
│   ├── ScrobbleFetcherInterface.php
│   ├── ScrobbleFetcher.php
│   └── Scrobble.php
└── scrobbles.php
5 directories, 12 files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment