-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
301 additions
and
112 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
# Accepted values: 8.2 - 8.1 | ||
ARG PHP_VERSION=8.2 | ||
|
||
ARG COMPOSER_VERSION=latest | ||
|
||
########################################### | ||
# Build frontend assets with NPM | ||
########################################### | ||
|
||
ARG NODE_VERSION=20-alpine | ||
|
||
FROM node:${NODE_VERSION} as build | ||
|
||
ENV ROOT=/var/www/html | ||
|
||
WORKDIR ${ROOT} | ||
|
||
RUN npm config set update-notifier false && npm set progress=false | ||
|
||
COPY package*.json ./ | ||
|
||
RUN if [ -f $ROOT/package-lock.json ]; \ | ||
then \ | ||
npm ci --no-optional --loglevel=error --no-audit; \ | ||
else \ | ||
npm install --no-optional --loglevel=error --no-audit; \ | ||
fi | ||
|
||
COPY . . | ||
|
||
RUN npm run build | ||
|
||
########################################### | ||
|
||
FROM composer:${COMPOSER_VERSION} AS vendor | ||
|
||
FROM php:${PHP_VERSION}-cli-bookworm | ||
|
||
LABEL maintainer="Seyed Morteza Ebadi <[email protected]>" | ||
|
||
ARG WWWUSER=1000 | ||
ARG WWWGROUP=1000 | ||
ARG TZ=UTC | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive \ | ||
TERM=xterm-color \ | ||
WITH_HORIZON=false \ | ||
WITH_SCHEDULER=false \ | ||
OCTANE_SERVER=roadrunner \ | ||
NON_ROOT_USER=octane \ | ||
ROOT=/var/www/html | ||
|
||
WORKDIR ${ROOT} | ||
|
||
SHELL ["/bin/bash", "-eou", "pipefail", "-c"] | ||
|
||
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \ | ||
&& echo ${TZ} > /etc/timezone | ||
|
||
RUN apt-get update; \ | ||
apt-get upgrade -yqq; \ | ||
pecl -q channel-update pecl.php.net; \ | ||
apt-get install -yqq --no-install-recommends --show-progress \ | ||
apt-utils \ | ||
gnupg \ | ||
git \ | ||
curl \ | ||
wget \ | ||
nano \ | ||
rsync \ | ||
ncdu \ | ||
sqlite3 \ | ||
libcurl4-openssl-dev \ | ||
ca-certificates \ | ||
supervisor \ | ||
libmemcached-dev \ | ||
libz-dev \ | ||
libbrotli-dev \ | ||
libpq-dev \ | ||
libjpeg-dev \ | ||
libpng-dev \ | ||
librsvg2-bin \ | ||
libfreetype6-dev \ | ||
libssl-dev \ | ||
libwebp-dev \ | ||
libmcrypt-dev \ | ||
libldap2-dev \ | ||
libonig-dev \ | ||
libmagickwand-dev \ | ||
libzip-dev zip unzip \ | ||
libargon2-1 \ | ||
libidn2-0 \ | ||
libpcre2-8-0 \ | ||
librdkafka-dev \ | ||
libpcre3 \ | ||
libxml2 \ | ||
libxslt-dev \ | ||
libzstd1 \ | ||
libc-ares-dev \ | ||
procps \ | ||
postgresql-client \ | ||
postgis \ | ||
default-mysql-client \ | ||
libbz2-dev \ | ||
zlib1g-dev \ | ||
libicu-dev \ | ||
g++ \ | ||
# Install PHP extensions | ||
&& docker-php-ext-install \ | ||
bz2 \ | ||
pcntl \ | ||
mbstring \ | ||
bcmath \ | ||
sockets \ | ||
pgsql \ | ||
pdo_pgsql \ | ||
opcache \ | ||
exif \ | ||
&& docker-php-ext-configure pdo_mysql && docker-php-ext-install pdo_mysql \ | ||
&& docker-php-ext-configure zip && docker-php-ext-install zip \ | ||
&& docker-php-ext-configure intl && docker-php-ext-install intl \ | ||
&& docker-php-ext-configure gd \ | ||
--prefix=/usr \ | ||
--with-jpeg \ | ||
--with-webp \ | ||
--with-freetype && docker-php-ext-install gd \ | ||
&& pecl -q install -o -f redis && docker-php-ext-enable redis \ | ||
&& pecl -q install -o -f imagick && docker-php-ext-enable imagick \ | ||
&& pecl -q install -o -f rdkafka && docker-php-ext-enable rdkafka \ | ||
&& pecl -q install -o -f memcached && docker-php-ext-enable memcached \ | ||
&& pecl -q install -o -f igbinary && docker-php-ext-enable igbinary \ | ||
&& docker-php-ext-configure ldap --with-libdir=lib/$(gcc -dumpmachine) && docker-php-ext-install ldap \ | ||
&& apt-get -y autoremove \ | ||
&& apt-get clean \ | ||
&& docker-php-source delete \ | ||
&& pecl clear-cache \ | ||
&& rm -R /tmp/pear \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ | ||
&& rm /var/log/lastlog /var/log/faillog | ||
|
||
RUN wget -q "https://github.com/aptible/supercronic/releases/download/v0.2.29/supercronic-linux-amd64" \ | ||
-O /usr/bin/supercronic \ | ||
&& chmod +x /usr/bin/supercronic \ | ||
&& mkdir -p /etc/supercronic \ | ||
&& echo "*/1 * * * * php ${ROOT}/artisan schedule:run --verbose --no-interaction" > /etc/supercronic/laravel | ||
|
||
RUN userdel --remove --force www-data \ | ||
&& groupadd --force -g ${WWWGROUP} ${NON_ROOT_USER} \ | ||
&& useradd -ms /bin/bash --no-log-init --no-user-group -g ${WWWGROUP} -u ${WWWUSER} ${NON_ROOT_USER} | ||
|
||
RUN chown -R ${NON_ROOT_USER}:${NON_ROOT_USER} ${ROOT} /var/{log,run} | ||
|
||
RUN chmod -R ug+rw /var/{log,run} | ||
|
||
USER ${NON_ROOT_USER} | ||
|
||
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} --from=vendor /usr/bin/composer /usr/bin/composer | ||
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} composer* ./ | ||
|
||
RUN composer install \ | ||
--no-dev \ | ||
--no-interaction \ | ||
--no-autoloader \ | ||
--no-ansi \ | ||
--no-scripts \ | ||
--audit | ||
|
||
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} . . | ||
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} --from=build ${ROOT}/public public | ||
|
||
RUN mkdir -p \ | ||
storage/framework/{sessions,views,cache,testing} \ | ||
storage/logs \ | ||
bootstrap/cache | ||
|
||
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/octane/RoadRunner/supervisord.roadrunner.conf /etc/supervisor/conf.d | ||
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/supervisord.scheduler.conf /etc/supervisor/conf.d/ | ||
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/supervisord.horizon.conf /etc/supervisor/conf.d/ | ||
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/php.ini /usr/local/etc/php/conf.d/99-octane.ini | ||
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/octane/RoadRunner/.rr.prod.yaml ./.rr.yaml | ||
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/start-container /usr/local/bin/start-container | ||
|
||
RUN composer install \ | ||
--classmap-authoritative \ | ||
--no-interaction \ | ||
--no-ansi \ | ||
--no-dev \ | ||
&& composer clear-cache \ | ||
&& php artisan storage:link | ||
|
||
RUN if composer show | grep spiral/roadrunner-cli >/dev/null; then \ | ||
./vendor/bin/rr get-binary; else \ | ||
echo "`spiral/roadrunner-cli` package is not installed. Exiting..."; exit 1; \ | ||
fi | ||
|
||
RUN chmod +x rr /usr/local/bin/start-container | ||
|
||
RUN cat deployment/utilities.sh >> ~/.bashrc | ||
|
||
EXPOSE 80 | ||
EXPOSE 6001 | ||
|
||
ENTRYPOINT ["start-container"] | ||
|
||
HEALTHCHECK --start-period=5s --interval=2s --timeout=5s --retries=8 CMD php artisan octane:status || exit 1 |
This file contains 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
Oops, something went wrong.