From 8f32655cf1b2c915ba3cb6a1112101fbf4ce3695 Mon Sep 17 00:00:00 2001 From: Mortexa <47121888+smortexa@users.noreply.github.com> Date: Mon, 18 Sep 2023 01:02:12 +0330 Subject: [PATCH] Revert "Add support for Vite builds (#41)" This reverts commit 74f1b02c03f37aed32dda2bf34e4f7223a50c297. --- Dockerfile | 210 +++++++++++++++++++++++------------------------------ README.md | 2 +- 2 files changed, 90 insertions(+), 122 deletions(-) diff --git a/Dockerfile b/Dockerfile index eb0a828..ded87a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,37 +6,6 @@ ARG COMPOSER_VERSION=latest # Accepted values: swoole - roadrunner ARG OCTANE_SERVER="swoole" -########################################### -# Build frontend assets with NPM -########################################### - -ARG NODE_VERSION=18-bullseye-slim - -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 \ - NODE_ENV=production npm ci --no-optional --loglevel=error --no-audit; \ - elif [ -f $ROOT/package.json ]; \ - then \ - NODE_ENV=production npm install --no-optional --loglevel=error --no-audit; \ - fi - -COPY . . - -RUN if [ -f $ROOT/package.json ] || [ -f $ROOT/package-lock.json ]; \ - then \ - npm run build; \ - fi - ########################################### # PHP dependencies ########################################### @@ -61,11 +30,11 @@ RUN composer install \ ########################################### RUN if [ ${OCTANE_SERVER} = "roadrunner" ]; then \ - 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 \ - fi + 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 \ + fi ########################################### @@ -86,11 +55,11 @@ ARG APP_WITH_HORIZON=false ARG APP_WITH_SCHEDULER=false ENV DEBIAN_FRONTEND=noninteractive \ - TERM=xterm-color \ - CONTAINER_MODE=${CONTAINER_MODE} \ - APP_WITH_HORIZON=${APP_WITH_HORIZON} \ - APP_WITH_SCHEDULER=${APP_WITH_SCHEDULER} \ - OCTANE_SERVER=${OCTANE_SERVER} + TERM=xterm-color \ + CONTAINER_MODE=${CONTAINER_MODE} \ + APP_WITH_HORIZON=${APP_WITH_HORIZON} \ + APP_WITH_SCHEDULER=${APP_WITH_SCHEDULER} \ + OCTANE_SERVER=${OCTANE_SERVER} ENV ROOT=/var/www/html WORKDIR $ROOT @@ -98,41 +67,41 @@ WORKDIR $ROOT SHELL ["/bin/bash", "-eou", "pipefail", "-c"] RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \ - && echo $TZ > /etc/timezone + && 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 \ - gosu \ - git \ - curl \ - wget \ - libcurl4-openssl-dev \ - ca-certificates \ - supervisor \ - libmemcached-dev \ - libz-dev \ - libbrotli-dev \ - libpq-dev \ - libjpeg-dev \ - libpng-dev \ - libfreetype6-dev \ - libssl-dev \ - libwebp-dev \ - libmcrypt-dev \ - libonig-dev \ - libzip-dev zip unzip \ - libargon2-1 \ - libidn2-0 \ - libpcre2-8-0 \ - libpcre3 \ - libxml2 \ - libzstd1 \ - procps \ - libbz2-dev + apt-get upgrade -yqq; \ + pecl -q channel-update pecl.php.net; \ + apt-get install -yqq --no-install-recommends --show-progress \ + apt-utils \ + gnupg \ + gosu \ + git \ + curl \ + wget \ + libcurl4-openssl-dev \ + ca-certificates \ + supervisor \ + libmemcached-dev \ + libz-dev \ + libbrotli-dev \ + libpq-dev \ + libjpeg-dev \ + libpng-dev \ + libfreetype6-dev \ + libssl-dev \ + libwebp-dev \ + libmcrypt-dev \ + libonig-dev \ + libzip-dev zip unzip \ + libargon2-1 \ + libidn2-0 \ + libpcre2-8-0 \ + libpcre3 \ + libxml2 \ + libzstd1 \ + procps \ + libbz2-dev ########################################### @@ -164,11 +133,11 @@ RUN docker-php-ext-install mbstring; ########################################### RUN docker-php-ext-configure gd \ - --prefix=/usr \ - --with-jpeg \ - --with-webp \ - --with-freetype \ - && docker-php-ext-install gd; + --prefix=/usr \ + --with-jpeg \ + --with-webp \ + --with-freetype \ + && docker-php-ext-install gd; ########################################### # OPcache @@ -177,7 +146,7 @@ RUN docker-php-ext-configure gd \ ARG INSTALL_OPCACHE=true RUN if [ ${INSTALL_OPCACHE} = true ]; then \ - docker-php-ext-install opcache; \ + docker-php-ext-install opcache; \ fi ########################################### @@ -187,9 +156,9 @@ RUN if [ ${INSTALL_OPCACHE} = true ]; then \ ARG INSTALL_PHPREDIS=true RUN if [ ${INSTALL_PHPREDIS} = true ]; then \ - pecl -q install -o -f redis \ - && rm -rf /tmp/pear \ - && docker-php-ext-enable redis; \ + pecl -q install -o -f redis \ + && rm -rf /tmp/pear \ + && docker-php-ext-enable redis; \ fi ########################################### @@ -199,7 +168,7 @@ RUN if [ ${INSTALL_PHPREDIS} = true ]; then \ ARG INSTALL_PCNTL=true RUN if [ ${INSTALL_PCNTL} = true ]; then \ - docker-php-ext-install pcntl; \ + docker-php-ext-install pcntl; \ fi ########################################### @@ -209,7 +178,7 @@ RUN if [ ${INSTALL_PCNTL} = true ]; then \ ARG INSTALL_BCMATH=true RUN if [ ${INSTALL_BCMATH} = true ]; then \ - docker-php-ext-install bcmath; \ + docker-php-ext-install bcmath; \ fi ########################################### @@ -219,9 +188,9 @@ RUN if [ ${INSTALL_BCMATH} = true ]; then \ ARG INSTALL_RDKAFKA=true RUN if [ ${INSTALL_RDKAFKA} = true ]; then \ - apt-get install -yqq --no-install-recommends --show-progress librdkafka-dev \ - && pecl -q install -o -f rdkafka \ - && docker-php-ext-enable rdkafka; \ + apt-get install -yqq --no-install-recommends --show-progress librdkafka-dev \ + && pecl -q install -o -f rdkafka \ + && docker-php-ext-enable rdkafka; \ fi ########################################### @@ -231,9 +200,9 @@ RUN if [ ${INSTALL_RDKAFKA} = true ]; then \ ARG SERVER=swoole RUN if [ ${OCTANE_SERVER} = "swoole" ]; then \ - apt-get install -yqq --no-install-recommends --show-progress libc-ares-dev \ - && pecl -q install -o -f -D 'enable-openssl="yes" enable-http2="yes" enable-swoole-curl="yes" enable-mysqlnd="yes" enable-cares="yes"' ${SERVER} \ - && docker-php-ext-enable ${SERVER}; \ + apt-get install -yqq --no-install-recommends --show-progress libc-ares-dev \ + && pecl -q install -o -f -D 'enable-openssl="yes" enable-http2="yes" enable-swoole-curl="yes" enable-mysqlnd="yes" enable-cares="yes"' ${SERVER} \ + && docker-php-ext-enable ${SERVER}; \ fi ########################################################################### @@ -243,9 +212,9 @@ RUN if [ ${OCTANE_SERVER} = "swoole" ]; then \ ARG INSTALL_INTL=true RUN if [ ${INSTALL_INTL} = true ]; then \ - apt-get install -yqq --no-install-recommends --show-progress zlib1g-dev libicu-dev g++ \ - && docker-php-ext-configure intl \ - && docker-php-ext-install intl; \ + apt-get install -yqq --no-install-recommends --show-progress zlib1g-dev libicu-dev g++ \ + && docker-php-ext-configure intl \ + && docker-php-ext-install intl; \ fi ########################################### @@ -255,7 +224,7 @@ RUN if [ ${INSTALL_INTL} = true ]; then \ ARG INSTALL_MEMCACHED=false RUN if [ ${INSTALL_MEMCACHED} = true ]; then \ - pecl -q install -o -f memcached && docker-php-ext-enable memcached; \ + pecl -q install -o -f memcached && docker-php-ext-enable memcached; \ fi ########################################### @@ -265,7 +234,7 @@ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \ ARG INSTALL_MYSQL_CLIENT=true RUN if [ ${INSTALL_MYSQL_CLIENT} = true ]; then \ - apt-get install -yqq --no-install-recommends --show-progress default-mysql-client; \ + apt-get install -yqq --no-install-recommends --show-progress default-mysql-client; \ fi ########################################### @@ -275,7 +244,7 @@ RUN if [ ${INSTALL_MYSQL_CLIENT} = true ]; then \ ARG INSTALL_PDO_PGSQL=false RUN if [ ${INSTALL_PDO_PGSQL} = true ]; then \ - docker-php-ext-install pdo_pgsql; \ + docker-php-ext-install pdo_pgsql; \ fi ########################################### @@ -285,7 +254,7 @@ RUN if [ ${INSTALL_PDO_PGSQL} = true ]; then \ ARG INSTALL_PGSQL=false RUN if [ ${INSTALL_PGSQL} = true ]; then \ - docker-php-ext-install pgsql; \ + docker-php-ext-install pgsql; \ fi ########################################### @@ -296,16 +265,16 @@ ARG INSTALL_PG_CLIENT=false ARG INSTALL_POSTGIS=false RUN if [ ${INSTALL_PG_CLIENT} = true ]; then \ - apt-get install -yqq gnupg \ - && . /etc/os-release \ - && echo "deb http://apt.postgresql.org/pub/repos/apt $VERSION_CODENAME-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ - && curl -sL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ - && apt-get update -yqq \ - && apt-get install -yqq --no-install-recommends --show-progress postgresql-client-12 postgis; \ - if [ ${INSTALL_POSTGIS} = true ]; then \ - apt-get install -yqq --no-install-recommends --show-progress postgis; \ - fi \ - && apt-get purge -yqq gnupg; \ + apt-get install -yqq gnupg \ + && . /etc/os-release \ + && echo "deb http://apt.postgresql.org/pub/repos/apt $VERSION_CODENAME-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ + && curl -sL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ + && apt-get update -yqq \ + && apt-get install -yqq --no-install-recommends --show-progress postgresql-client-12 postgis; \ + if [ ${INSTALL_POSTGIS} = true ]; then \ + apt-get install -yqq --no-install-recommends --show-progress postgis; \ + fi \ + && apt-get purge -yqq gnupg; \ fi ########################################### @@ -313,27 +282,26 @@ RUN if [ ${INSTALL_PG_CLIENT} = true ]; then \ ########################################### RUN if [ ${CONTAINER_MODE} = 'scheduler' ] || [ ${APP_WITH_SCHEDULER} = true ]; then \ - wget -q "https://github.com/aptible/supercronic/releases/download/v0.2.26/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; \ + wget -q "https://github.com/aptible/supercronic/releases/download/v0.2.26/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; \ fi ########################################### RUN groupadd --force -g $WWWGROUP octane \ - && useradd -ms /bin/bash --no-log-init --no-user-group -g $WWWGROUP -u $WWWUSER octane + && useradd -ms /bin/bash --no-log-init --no-user-group -g $WWWGROUP -u $WWWUSER octane RUN 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 + && 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 COPY . . -COPY --from=build ${ROOT}/public public COPY --from=vendor ${ROOT}/vendor vendor COPY --from=vendor ${ROOT}/rr* ${ROOT}/composer.json ./ @@ -352,7 +320,7 @@ COPY deployment/octane/.rr.prod.yaml ./.rr.yaml RUN chmod +x deployment/octane/entrypoint.sh RUN if [ -f "rr" ]; then \ - chmod +x rr; \ + chmod +x rr; \ fi RUN cat deployment/octane/utilities.sh >> ~/.bashrc diff --git a/README.md b/README.md index 8943a61..8b79a75 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ Also, some useful Bash functions and aliases are added in `utilities.sh` that ma ## ToDo - [x] Add support for Horizon - [x] Add support for RoadRunner -- [x] Add support for the full-stack apps (Front-end assets) +- [ ] Add support for the full-stack apps (Front-end assets) - [ ] Add support `testing` environment and CI - [x] Add support for the Laravel scheduler - [ ] Add support for Laravel Dusk