So, there are some great Docker images like Wordpess, and bitnami/phpbb.
Why not make a similar solution for SMF? Let's try :)
This is a Docker image for testing the latest stable version of SMF.
Это образ Docker для тестирования текущей стабильной версии SMF.
- Docker Desktop
- Docker Compose
See .env
file.
- Change
PHP_VERSION
in.env
file - Run
docker compose build php-fpm
- Run
docker compose down
- Run
docker compose up -d
docker compose up -d
docker compose down
docker compose -f nginx.yaml up -d
docker compose -f nginx.yaml down
Use the following information to install/configure your SMF:
Service | Hostname | Port number |
---|---|---|
MySQL | mysql | 3306 (default) |
MariaDB | mariadb | 3306 (default) |
Postgres | postgres | 5432 (default) |
Memcached | memcached | 11211 (default) |
Redis | redis | 6379 (default) |
FTP | ftp | 21 (default) |
Login/pass by default - user/pass
.
If you remove the container all your data will be lost, and the next time you run the image the database will be reinitialized. To avoid this loss of data, you should mount a volume that will persist even after the container is removed.
For persistence you should mount a directory at the /app
path. If the mounted directory is empty, it will be initialized on the first run. Additionally you should mount a volume for persistence of the MariaDB or PostgreSQL data.
To avoid inadvertent removal of volumes, you can mount host directories as data volumes. Alternatively you can make use of volume plugins to host the volume data.
Export:
docker exec mariadb sh -c 'exec mysqldump "$MYSQL_DATABASE" -u"$MYSQL_USER" -p"$MYSQL_PASSWORD"' > mysql_databases.sql
Import:
docker exec -i mariadb sh -c 'exec mysql "$MYSQL_DATABASE" -u"$MYSQL_USER" -p"$MYSQL_PASSWORD"' < mysql_databases.sql
Export:
docker exec postgres sh -c 'exec pg_dump "$POSTGRES_DB" -U "$POSTGRES_USER"' > pgsql_databases.sql
Import:
docker exec postgres sh -c 'exec psql "$POSTGRES_DB" -U "$POSTGRES_USER"' < pgsql_databases.sql
To install xdebug extension just add this line in php-fpm/Dockerfile
:
php${PHP_VERSION}-redis \
+ php${PHP_VERSION}-xdebug; \
To configure Xdebug 3 you need add these lines in php-fpm/php-ini-overrides.ini
:
xdebug.mode = debug
xdebug.remote_connect_back = true
xdebug.start_with_request = yes
xdebug.mode = debug
xdebug.remote_host = host.docker.internal
xdebug.start_with_request = yes
environment:
PHP_IDE_CONFIG: "serverName=Docker"
- In PHPStorm open Preferences | Languages & Frameworks | PHP | Servers
- Add new server
- The “Name” field should be the same as the parameter “serverName” value in “environment” in compose.yaml (i.e. Docker in the example above)
- A value of the "port" field should be the same as first port(before a colon) in "webserver" service in compose.yaml
- Select "Use path mappings" and set mappings between a path to your project on a host system and the Docker container.
- Finally, add “Xdebug helper” extension in your browser, set breakpoints and start debugging
See Docker for local web development, introduction: why should you care?
If this solution seems too complicated for you, try Laradock.