Forem

Horacio Degiorgi
Horacio Degiorgi

Posted on

4

Docker-compose for older PHP Apps

Migrate old apps in php sometimes is complicated because is working only for old php version.
I've an old apps working for php 5.2 (some of the libraries are really old) and I need a development environment.
Doing some research I discovered http://devilbox.org/ .
A docker images with a plenty of options and documentation.
My Apps also need postgresql and some php extensions.
In a simple docker-compose recipe I found everything I needed.

###############################################################################
# Generated on phpdocker.io #
###############################################################################
version: "3.1"
services:
db:
image: postgres:10
container_name: ideas-db
restart: always
volumes:
- /datos/webs/filo/pgdb:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: ${dbpassword}
pgadmin:
image: dpage/pgadmin4
container_name: ideas-pgadmin
restart: always
ports:
- "8101:80"
environment:
PGADMIN_DEFAULT_EMAIL: ${email}
PGADMIN_DEFAULT_PASSWORD: ${password}
volumes:
- /datos/webs/filo/pgadmin:/var/lib/pgadmin
webserver:
image: nginx:alpine
container_name: ideas-webserver
working_dir: /application
volumes:
- /datos/webs/filo:/application/public
- ./phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- "8100:80"
php-fpm:
image: devilbox/php-fpm:7.0-mods
container_name: ideas-php-fpm
working_dir: /application
environment:
ENABLE_MODULES: soap,pgsql,curl,intl,json,xmlrpc,xml,zip
volumes:
- /datos/webs/filo:/application/public
- ./phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/7.0/fpm/conf.d/99-overrides.ini

I'm running also a pgadmin and a postgresql server with persistent storage.
Docker expose the webserver in the 8100 port and pgadmin in the 8101 port.
All the variables are stored in a .env file in the same directory.

email=myemail@gmail.com
password=some
dbpassword=somedbpass
view raw .env hosted with ❤ by GitHub

With this simple recipe and docker installed in my laptop with ubuntu I'm ready for a migration to php 7.3 version.

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay