Skip to content

Instantly share code, notes, and snippets.

@keevitaja
Created April 19, 2024 11:27
Show Gist options
  • Save keevitaja/f4c387c9d7a7cb10b8cb8482f7e72f3a to your computer and use it in GitHub Desktop.
Save keevitaja/f4c387c9d7a7cb10b8cb8482f7e72f3a to your computer and use it in GitHub Desktop.
Custom docker image based on official php:8.3-apache image which is based on debian.
FROM php:8.3-apache
ARG DOCKER_APP_UID
ARG DOCKER_APP_GID
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL C.UTF-8
RUN apt-get update && apt-get install -y \
libzip-dev \
libmemcached-dev \
zlib1g-dev \
openssl \
git \
supervisor \
unzip \
openssh-server \
libicu-dev \
libpng-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libxml2-dev \
libxslt-dev \
libpq-dev \
postgresql-client \
libmagickwand-dev \
curl \
gnupg \
ca-certificates \
sudo
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
RUN docker-php-ext-install \
zip \
pdo_mysql \
pdo_pgsql \
pcntl \
opcache \
intl \
soap \
xsl \
sockets \
-j$(nproc) gd
RUN pecl install \
memcached-3.1.5 \
redis \
imagick \
xdebug
RUN docker-php-ext-enable \
memcached \
redis \
imagick \
xdebug
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update && apt-get install nodejs -y
RUN php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer
# installing google-chrome-stable
RUN apt-get install -y gnupg wget curl unzip --no-install-recommends; \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | \
gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/google.gpg --import; \
chmod 644 /etc/apt/trusted.gpg.d/google.gpg; \
echo "deb https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list; \
apt-get update -y; \
apt-get install -y google-chrome-stable;
# installing chromedriver
RUN CHROMEDRIVER_VERSION=$(curl https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_STABLE); \
wget -N https://storage.googleapis.com/chrome-for-testing-public/$CHROMEDRIVER_VERSION/linux64/chromedriver-linux64.zip -P ~/ && \
unzip ~/chromedriver-linux64.zip -d ~/ && \
rm ~/chromedriver-linux64.zip && \
mv -f ~/chromedriver-linux64/chromedriver /usr/bin/chromedriver && \
rm -rf ~/chromedriver-linux64
RUN groupadd -g ${DOCKER_APP_GID} -f user
RUN useradd -s /bin/bash user -u ${DOCKER_APP_UID} -g ${DOCKER_APP_GID} -d /home/user
RUN chown -R user:user /var/www/html
RUN echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN ln -s /etc/apache2/sites-available/vhost.conf /etc/apache2/sites-enabled/vhost.conf
RUN rm -rf /var/log/apache2/*
RUN mkdir -p /var/log/supervisor
RUN mkdir -p /run/sshd
RUN mkdir -p /var/log/app
RUN a2enmod rewrite
RUN a2enmod headers
RUN a2enmod ssl
RUN a2enmod proxy
RUN a2enmod proxy_http
RUN a2enmod proxy_balancer
RUN a2enmod lbmethod_byrequests
# mkcert -key-file cert.key.pem -cert-file cert.pem smog-mvp.localhost *.smog-mvp.localhost
COPY cert.pem /etc/ssl/certs
COPY cert.key.pem /etc/ssl/private
COPY vhost.conf /etc/apache2/sites-available/vhost.conf
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /usr/local/etc/php/conf.d
EXPOSE 22 80 443 5888
CMD ["/usr/bin/supervisord"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment