Browse Source

feat: create build script and change Dockerfile

master php-7.4
Dennis Buchhorn 3 years ago
parent
commit
babd07dcc9
2 changed files with 30 additions and 0 deletions
  1. +5
    -0
      Dockerfile
  2. +25
    -0
      build_script

+ 5
- 0
Dockerfile View File

@ -6,6 +6,11 @@
FROM debian:buster-slim FROM debian:buster-slim
ARG PHP_APACHE_WWW_DATA_UID=33
ARG PHP_APACHE_WWW_DATA_GID=33
RUN groupmod -g $PHP_APACHE_WWW_DATA_GID www-data; \
usermod -u $PHP_APACHE_WWW_DATA_UID -g $PHP_APACHE_WWW_DATA_GID www-data
# prevent Debian's PHP packages from being installed # prevent Debian's PHP packages from being installed
# https://github.com/docker-library/php/pull/542 # https://github.com/docker-library/php/pull/542
RUN set -eux; \ RUN set -eux; \


+ 25
- 0
build_script View File

@ -0,0 +1,25 @@
#!/bin/bash
echo "####################################################################"
echo "# docker_php_apache_build_script #"
echo "# Dennis Buchhorn - bucde@b-eit.de #"
echo "####################################################################"
echo "# This script will build an 'php:7.4-apache-buster' image with #"
echo "# customized uid and gid for 'www-data' user. #"
echo "# With this you can bind mount volumes to /var/www/html/* and have #"
echo "# the same permissions from the host (if uid and gid matches). #"
#echo "# #"
echo "####################################################################"
echo ""
PHP_APACHE_IMAGE_NAME="b-eit/php:7.4-apache-buster"
PHP_APACHE_WWW_DATA_UID=""
PHP_APACHE_WWW_DATA_GID=""
read -p "Enter uid for 'www-data' user: " PHP_APACHE_WWW_DATA_UID
read -p "Enter gid for 'www-data' user: " PHP_APACHE_WWW_DATA_GID
docker build -t $PHP_APACHE_IMAGE_NAME --build-arg PHP_APACHE_WWW_DATA_UID=$PHP_APACHE_WWW_DATA_UID --build-arg PHP_APACHE_WWW_DATA_GID=$PHP_APACHE_WWW_DATA_GID .
echo "Done!"

Loading…
Cancel
Save