Skip to content

Docker container with Apache and PHP builded by Nix

License

Notifications You must be signed in to change notification settings

6d6a/webservices-apache2-php74

Repository files navigation

Apache PHP 7.4

Docker container with Apache PHP 7.4 build by Nix package manager.

Prerequisites

Before you begin, ensure you have met the following requirements:

Building Apache PHP 7.4

To build Apache PHP 7.4, follow these steps:

Linux and macOS:

docker load --input $(nix-build --argstr overlayUrl https://github.com/mjuh/ci-nixpkgs.git --no-out-link)

Hint: If you failed to build with your current nixpkgs version, try to build with a tested nixpkgs version.

Build Status

Using Apache PHP 7.4

To use Apache PHP 7.4, call:

docker inspect docker-registry.intr/webservices/apache2-php74 | grep cmd

which will produce flags for docker run command as a hint.

For example:

docker run --read-only --network=host \
        --mount readonly,source=/etc/ssl,target=/etc/ssl,type=bind \
        --mount readonly,source=$SITES_CONF_PATH,target=/read/sites-enabled,type=bind \
        --mount readonly,source=/opt/etc,target=/opt/etc,type=bind \
        --mount source=/opt/postfix/spool/maildrop,target=/var/spool/postfix/maildrop,type=bind \
        --mount source=/opt/postfix/spool/public,target=/var/spool/postfix/public,type=bind \
        --mount source=/opt/postfix/lib,target=/var/lib/postfix,type=bind \
        --mount source=/opcache,target=/opcache,type=bind \
        --mount target=/run,type=tmpfs \
        --mount source=/home,target=/home,type=bind \
        --tmpfs /tmp:mode=1777 \
        --tmpfs /run/bin:exec,suid \
        -e HTTPD_PORT=$SOCKET_HTTP_PORT \
        -e PHP_INI_SCAN_DIR=:/etc/phpsec/$SECURITY_LEVEL \
        -e PHP_SECURITY=/etc/phpsec/$SECURITY_LEVEL \
        --ulimit stack=-1:-1 \
        --cap-add SYS_ADMIN \
        --security-opt apparmor:unconfined docker-registry.intr/webservices/apache2-php74:latest

before running the command you need to provide all variables:

  • $SITES_CONF_PATH should point to a directory with Apache's configuration files for vhosts.
  • $SECURITY_LEVEL should be one of: default, unsafe, hardened, hardened-nochmod.
  • $SOCKET_HTTP_PORT any free port on your computer, e.g. 8074.

Contributing to Apache PHP 7.4

To contribute to Apache PHP 7.4, follow these steps:

  1. Fork this repository.
  2. Create a branch: git checkout -b <branch_name>.
  3. Make your changes and commit them: git commit -m '<commit_message>'
  4. Push to the original branch: git push origin <project_name>/<location>
  5. Create the pull request.

Contact

If you want to contact me you can reach us at support@majordomo.ru.

License

This project uses the following license: Apache-2.0.