Created
July 29, 2022 11:45
-
-
Save claudsonm/043276e66f7d5ef43d436c1e466e16db to your computer and use it in GitHub Desktop.
Docker image with PHP and Composer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:7.4-cli | |
RUN apt-get update && apt-get install -y \ | |
curl \ | |
build-essential \ | |
git \ | |
zip \ | |
unzip \ | |
libzip-dev \ | |
libpng-dev \ | |
libjpeg62-turbo-dev \ | |
libfreetype6-dev \ | |
libonig-dev \ | |
libxml2-dev \ | |
libicu-dev && \ | |
apt-get clean && rm -rf /var/lib/apt/lists/* | |
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer | |
# Create system user to run Composer and Artisan Commands | |
RUN useradd -G www-data,root -u 1000 -d /home/phpuser phpuser | |
RUN mkdir -p /home/phpuser/.composer && \ | |
chown -R phpuser:phpuser /home/phpuser && \ | |
mkdir -p /var/www/html && \ | |
chown -R phpuser:phpuser /var/www/html | |
WORKDIR /var/www/html | |
USER $user | |
# docker build -t php74-custom . | |
# docker run --rm -it --volume $PWD:/var/www/html --user $(id -u):$(id -g) php74-custom bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment