Pre-build PHP modules

pull/1/head
Jason Kendall 2019-11-28 11:33:12 -05:00
parent c5da23be90
commit 52f6810177
2 changed files with 29 additions and 10 deletions

View File

@ -17,4 +17,6 @@ Server image notes:
- Original Image: 3.17GB - Original Image: 3.17GB
- First attempt: 2.24GB - First attempt: 2.24GB
- Remove chown: 1.56GB - Remove chown: 1.56GB
- Saved: 1.61GB - PreBuild python modules, and only pull submodules we need: 800MB
- PreBuild PHP modules: 664MB
- Saved: 2.5GB

View File

@ -1,3 +1,18 @@
FROM debian:buster-slim as php-build
RUN apt-get update; apt-get install -y --no-install-recommends \
gcc \
make \
libfuzzy-dev \
ca-certificates \
php \
php-dev \
php-pear \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
RUN cp /usr/lib/x86_64-linux-gnu/libfuzzy.* /usr/lib; pecl install ssdeep
FROM debian:buster-slim as python-build FROM debian:buster-slim as python-build
RUN apt-get update; apt-get install -y --no-install-recommends \ RUN apt-get update; apt-get install -y --no-install-recommends \
gcc \ gcc \
@ -41,32 +56,33 @@ FROM debian:buster-slim as python-build
FROM debian:buster-slim FROM debian:buster-slim
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
ARG MISP_TAG=2.4.118 ARG MISP_TAG=2.4.118
ARG PHP_VER=20180731
# OS Packages # OS Packages
RUN apt-get update; apt-get install -y --no-install-recommends \ RUN apt-get update; apt-get install -y --no-install-recommends \
sudo \ sudo \
apache2 \ apache2 \
supervisor \ supervisor \
git make \ git \
cron \ cron \
gcc \
zip unzip \
openssl \ openssl \
gpg-agent gpg \ gpg-agent gpg \
python3 \ python3 \
python3-setuptools \ python3-setuptools \
python3-pip \ python3-pip \
ssdeep \ ssdeep \
mariadb-client \
zip unzip \
php \ php \
php-xml \ php-xml \
php-mbstring \ php-mbstring \
php-mysql \ php-mysql \
php-pear \ # php-dev \
php-dev \
php-redis \ php-redis \
php-gd \ php-gd \
libfuzzy-dev \ libfuzzy2 \
mariadb-client \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
# MISP code # MISP code
@ -87,6 +103,7 @@ ARG MISP_TAG=2.4.118
# CakePHP # CakePHP
# Once done, install CakeResque, first get latest composer # Once done, install CakeResque, first get latest composer
COPY --from=php-build /usr/lib/php/${PHP_VER}/ssdeep.so /usr/lib/php/${PHP_VER}/ssdeep.so
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/MISP/app WORKDIR /var/www/MISP/app
RUN composer install \ RUN composer install \
@ -94,8 +111,8 @@ ARG MISP_TAG=2.4.118
;phpenmod redis \ ;phpenmod redis \
# Enable CakeResque with php-gnupgp # Enable CakeResque with php-gnupgp
;phpenmod gnupg \ ;phpenmod gnupg \
#installing ssdeep_php - pecl is dumb, we need to ensure the libs are in the specific place # Enable ssdeep we build earlier
;cp /usr/lib/x86_64-linux-gnu/libfuzzy.* /usr/lib; pecl install ssdeep; phpenmod ssdeep \ ;phpenmod ssdeep \
# To use the scheduler worker for scheduled tasks, do the following: # To use the scheduler worker for scheduled tasks, do the following:
;cp -fa /var/www/MISP/INSTALL/setup/config.php /var/www/MISP/app/Plugin/CakeResque/Config/config.php ;cp -fa /var/www/MISP/INSTALL/setup/config.php /var/www/MISP/app/Plugin/CakeResque/Config/config.php