Skip to content

Instantly share code, notes, and snippets.

@ziadoz
Created September 30, 2021 16:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ziadoz/193a48ec9a5d17f528d6eaa465afb4bb to your computer and use it in GitHub Desktop.
Save ziadoz/193a48ec9a5d17f528d6eaa465afb4bb to your computer and use it in GitHub Desktop.
Docker - PHP, Composer, Google Chrome and ChromeDriver
FROM php:8.0-fpm
# Copy Composer:
COPY --from=composer /usr/bin/composer /usr/bin/composer
# Install PHP extensions:
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions && \
install-php-extensions zip
# Install Google Chrome:
RUN apt-get update && \
apt-get install -y gnupg2 && \
curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add && \
echo "deb https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list && \
apt-get -y update && \
apt-get -y install google-chrome-stable
# Install ChromeDriver:
RUN apt-get update && \
apt-get install -y unzip && \
curl -sS https://chromedriver.storage.googleapis.com/94.0.4606.61/chromedriver_linux64.zip -o chromedriver.zip && \
unzip chromedriver.zip && \
rm chromedriver.zip && \
chmod +x chromedriver && \
mv -f chromedriver /usr/local/bin/chromedriver
# Cleanup:
RUN apt-get -y autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN cp "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment