You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
3.7 KiB
144 lines
3.7 KiB
# From here we will move the composer binary
|
|
FROM composer:1.10 AS composer
|
|
|
|
# Download base image ubuntu 20.04
|
|
FROM ubuntu:20.04
|
|
|
|
# Changing sh shell to bash
|
|
SHELL ["/bin/bash", "-c", "-o", "pipefail"]
|
|
|
|
# Change working directory
|
|
WORKDIR /var/www/html
|
|
|
|
# Disable Prompt During Packages Installation
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Prepare NodeJS
|
|
RUN apt-get update -y && \
|
|
apt-get install -y --no-install-recommends \
|
|
ca-certificates \
|
|
curl && \
|
|
curl -sL https://deb.nodesource.com/setup_16.x | bash -
|
|
|
|
# Prepare Yarn
|
|
RUN apt-get update -y && \
|
|
apt-get install -y --no-install-recommends \
|
|
ca-certificates \
|
|
curl && \
|
|
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
|
|
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
|
|
|
|
# Install Apache, NodeJS, PHP7.4-FPM, Supervisor
|
|
RUN apt-get update -y && \
|
|
apt-get install -y --no-install-recommends \
|
|
apache2 \
|
|
apache2-doc \
|
|
apache2-utils \
|
|
git \
|
|
libapache2-mod-fcgid \
|
|
nodejs \
|
|
php7.4 \
|
|
php7.4-calendar \
|
|
php7.4-common \
|
|
php7.4-fileinfo \
|
|
php7.4-ftp \
|
|
php7.4-fpm \
|
|
php7.4-gettext \
|
|
php7.4-iconv \
|
|
php7.4-json \
|
|
php7.4-mbstring \
|
|
php7.4-opcache \
|
|
php7.4-pdo \
|
|
php7.4-phar \
|
|
php7.4-posix \
|
|
php7.4-readline \
|
|
php7.4-sockets \
|
|
php7.4-sqlite3 \
|
|
php7.4-tokenizer \
|
|
php7.4-xml \
|
|
php7.4-zip \
|
|
software-properties-common \
|
|
supervisor \
|
|
yarn
|
|
|
|
# Configure packages
|
|
RUN a2enmod rewrite actions fcgid alias proxy_fcgi setenvif remoteip && \
|
|
a2enconf php7.4-fpm && \
|
|
bash -c 'echo "RemoteIPHeader X-Forwarded-For" >> /etc/apache2/apache2.conf' && \
|
|
sed -i "s/LogFormat \"%v:%p %h/LogFormat \"%v:%p %a/g" /etc/apache2/apache2.conf && \
|
|
sed -i "s/LogFormat \"%h/LogFormat \"%a/g" /etc/apache2/apache2.conf && \
|
|
sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf && \
|
|
mkdir -p /run/php && \
|
|
mkdir -p /var/run/apache2 && \
|
|
mkdir -p /var/lock/apache2 && \
|
|
mkdir -p /var/log/supervisor && \
|
|
chown -R www-data:www-data /var/www/html && \
|
|
chown -R www-data:www-data /run/php && \
|
|
rm /var/www/html/index.html
|
|
|
|
|
|
# Update NPM to last version
|
|
RUN npm i -g npm
|
|
|
|
# Install Duckling
|
|
RUN apt-get update -y && \
|
|
apt-get -y install --no-install-recommends \
|
|
libpcre3 \
|
|
libpcre3-dev \
|
|
pkg-config && \
|
|
git clone https://github.com/facebook/duckling.git fb-duckling && \
|
|
curl -sSL https://get.haskellstack.org/ | sh && \
|
|
cd fb-duckling && \
|
|
stack build
|
|
|
|
# This is a laravel application, change DocRoot
|
|
RUN sed -i 's/\/var\/www\/html/&\/public/g' /etc/apache2/sites-available/000-default.conf
|
|
|
|
|
|
# Expose environment variables
|
|
RUN sed -i 's/;clear_env = .*/clear_env = no/g' /etc/php/*/fpm/pool.d/www.conf
|
|
|
|
# Install LibreOffice
|
|
RUN apt-get update -y && \
|
|
apt-add-repository -y ppa:libreoffice/ppa && \
|
|
apt-get update -y && \
|
|
apt-get install -y libreoffice
|
|
|
|
# Cleanup apt cache
|
|
RUN rm -rf /var/lib/apt/lists/*
|
|
|
|
# Prepare Supervisor
|
|
RUN mkdir /var/log/queue
|
|
|
|
# Move configuraton files
|
|
COPY conf/supervisord_core.conf /etc/supervisor/conf.d/supervisord.conf
|
|
|
|
# Move repository
|
|
COPY --chown=www-data:www-data searchanddisplace-core/ .
|
|
|
|
# Here we do the magic!
|
|
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
|
|
|
|
# Install PHP Dependencies
|
|
RUN composer install --no-progress
|
|
|
|
# Generate key
|
|
RUN php artisan key:generate
|
|
|
|
# Install JS Dependencies
|
|
RUN rm -rf node_modules && \
|
|
npm install && \
|
|
npm run production
|
|
|
|
# Migrate Database
|
|
RUN touch ./database/database.sqlite && \
|
|
chown www-data:www-data ./database/database.sqlite && \
|
|
php artisan migrate
|
|
|
|
# Expose Port for the Application
|
|
EXPOSE 80 443
|
|
|
|
# Copy start.sh script and define default command for the container
|
|
CMD ["/usr/bin/supervisord"]
|
|
|
|
|