Skip to content

eriksoderblom/alpine-apache-php

Repository files navigation

alpine-apache-php

Alpine based image with apache2 and php8

You can use either of these built images:
ghcr.io/eriksoderblom/alpine-apache-php:latest
eriksoderblom/alpine-apache-php:latest

You can find other (older versions) at Docker Hub

Define environnement variables (optional)

  • SERVER_ADMIN (an email, defaults to you@example.com)
  • HTTP_SERVER_NAME (a server name, defaults to www.example.com)
  • HTTPS_SERVER_NAME (a server name, defaults to www.example.com)
  • LOG_LEVEL (a log level, defaults to info)
  • TZ (a timezone, defaults to UTC)
  • PHP_MEMORY_LIMIT (a memory-limit, defaults to 256M)

Build

Replace alpine-apache-php and tags with whatever you want when building your own image.

docker build -t alpine-apache-php:latest .

Run

Change the left side port 80, 443 and /docker/data/www to your preferred values.
You can use the image name from the previous step if you built your own image.

docker run --detach \
    --name alpine-apache-php \
    --publish 80:80 \
    --publish 443:443 \
    --restart unless-stopped \
    --volume /docker/data/www:/htdocs \
    eriksoderblom/alpine-apache-php:latest

Compose example

services:
    alpine-apache-php:
        container_name: alpine-apache-php
        hostname: www.example.com
        environment:
            - SERVER_ADMIN="admin@www.example.com"
            - HTTP_SERVER_NAME="www.example.com"
            - HTTPS_SERVER_NAME="www.example.com"
            - TZ="UTC"
            - PHP_MEMORY_LIMIT="256M"
            - LOG_LEVEL="error"
        ports:
            - '80:80'
            - '443:443'
        restart: unless-stopped
        volumes:
            - '/docker/data/www:/htdocs'
        image: 'eriksoderblom/alpine-apache-php:latest'

Customized run

docker run --detach \
    --name alpine-apache-php-custom \
    --hostname alpine-apache-php.local \
    --env HTTP_SERVER_NAME="www.example.xyz" \
    --env HTTPS_SERVER_NAME="www.example.xyz" \
    --env SERVER_ADMIN="admin@example.xyz" \
    --env TZ="Europe/Paris" \
    --env PHP_MEMORY_LIMIT="512M" \
    --publish 80:80 \
    --publish 443:443 \
    --restart unless-stopped \
    --volume /docker/data/www:/htdocs \
    eriksoderblom/alpine-apache-php:latest

About

Alpine based docker image with apache2 and php8

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors