|
| 1 | +FROM ubuntu:24.04 |
| 2 | + |
| 3 | +LABEL maintainer="Taylor Otwell" |
| 4 | + |
| 5 | +ARG WWWGROUP |
| 6 | +ARG NODE_VERSION=22 |
| 7 | +ARG MYSQL_CLIENT="mysql-client" |
| 8 | +ARG POSTGRES_VERSION=17 |
| 9 | + |
| 10 | +WORKDIR /var/www/html |
| 11 | + |
| 12 | +ENV DEBIAN_FRONTEND=noninteractive |
| 13 | +ENV TZ=UTC |
| 14 | +ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" |
| 15 | +ENV SUPERVISOR_PHP_USER="sail" |
| 16 | +ENV PATH="$PATH:/root/.composer/vendor/bin" |
| 17 | + |
| 18 | +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone |
| 19 | + |
| 20 | +RUN echo "Acquire::http::Pipeline-Depth 0;" > /etc/apt/apt.conf.d/99custom && \ |
| 21 | + echo "Acquire::http::No-Cache true;" >> /etc/apt/apt.conf.d/99custom && \ |
| 22 | + echo "Acquire::BrokenProxy true;" >> /etc/apt/apt.conf.d/99custom |
| 23 | + |
| 24 | +RUN apt-get update && apt-get upgrade -y |
| 25 | +RUN mkdir -p /etc/apt/keyrings |
| 26 | +RUN apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python3 dnsutils librsvg2-bin fswatch ffmpeg nano |
| 27 | +RUN curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xb8dc7e53946656efbce4c1dd71daeaab4ad4cab6' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null |
| 28 | +RUN echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble main" > /etc/apt/sources.list.d/ppa_ondrej_php.list |
| 29 | +RUN apt-get update |
| 30 | +RUN apt-get install -y php8.4-cli php8.4-dev \ |
| 31 | + php8.4-pgsql php8.4-sqlite3 php8.4-gd \ |
| 32 | + php8.4-curl php8.4-mongodb \ |
| 33 | + php8.4-imap php8.4-mysql php8.4-mbstring \ |
| 34 | + php8.4-xml php8.4-zip php8.4-bcmath php8.4-soap \ |
| 35 | + php8.4-intl php8.4-readline \ |
| 36 | + php8.4-ldap \ |
| 37 | + php8.4-msgpack php8.4-igbinary php8.4-redis php8.4-swoole \ |
| 38 | + php8.4-memcached php8.4-pcov php8.4-imagick php8.4-xdebug |
| 39 | +RUN curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer |
| 40 | +RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg |
| 41 | +RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" > /etc/apt/sources.list.d/nodesource.list |
| 42 | +RUN apt-get update |
| 43 | +RUN apt-get install -y nodejs |
| 44 | +RUN npm install -g npm |
| 45 | +RUN npm install -g pnpm |
| 46 | +RUN npm install -g bun |
| 47 | +RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarn.gpg >/dev/null |
| 48 | +RUN echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list |
| 49 | +RUN curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg >/dev/null |
| 50 | +RUN echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt noble-pgdg main" > /etc/apt/sources.list.d/pgdg.list |
| 51 | +RUN apt-get update |
| 52 | +RUN apt-get install -y yarn |
| 53 | +RUN apt-get install -y $MYSQL_CLIENT |
| 54 | +RUN apt-get install -y postgresql-client-$POSTGRES_VERSION |
| 55 | +# RUN pecl install grpc protobuf |
| 56 | +# # RUN docker-php-ext-enable grpc protobuf |
| 57 | +# RUN echo "extension=grpc.so" > /etc/php/8.4/cli/conf.d/99-grpc.ini && \ |
| 58 | +# echo "extension=protobuf.so" > /etc/php/8.4/cli/conf.d/99-protobuf.ini |
| 59 | + |
| 60 | +# gRPC tooling libs |
| 61 | +# RUN apt-get install -y libgrpc-dev libpng-dev zlib1g-dev libicu-dev libonig-dev libxml2-dev libprotobuf-dev protobuf-compiler |
| 62 | + |
| 63 | +# COPY ./.docker/php-extensions/*.so /usr/lib/php/20240924/ |
| 64 | +RUN mkdir -p /tmp/php-extensions |
| 65 | +RUN curl -L https://github.com/rxcod9/laravel-grpc-example/releases/download/v1.0.0/php8.4-grpc.so.tar.gz \ |
| 66 | + | tar -xz -C /tmp/php-extensions |
| 67 | +RUN curl -L https://github.com/rxcod9/laravel-grpc-example/releases/download/v1.0.0/php8.4-protobuf.so.tar.gz \ |
| 68 | + | tar -xz -C /tmp/php-extensions |
| 69 | +RUN cp -r /tmp/php-extensions/*.so /usr/lib/php/20240924/ |
| 70 | +RUN rm -rf /tmp/php-extensions |
| 71 | +RUN echo "extension=grpc.so" > /etc/php/8.4/cli/conf.d/99-grpc.ini && \ |
| 72 | + echo "extension=protobuf.so" > /etc/php/8.4/cli/conf.d/99-protobuf.ini |
| 73 | + |
| 74 | +# Create directory for binaries |
| 75 | +RUN mkdir -p /usr/local/bin |
| 76 | + |
| 77 | +# Download and extract RR binary safely in /tmp, then move to /usr/local/bin |
| 78 | +RUN mkdir -p /tmp/roadrunner |
| 79 | +RUN curl -L https://github.com/roadrunner-server/roadrunner/releases/download/v2025.1.2/roadrunner-2025.1.2-linux-amd64.tar.gz \ |
| 80 | + | tar -xz -C /tmp/roadrunner --strip-components=1 |
| 81 | +RUN mv /tmp/roadrunner/rr /usr/local/bin/rr |
| 82 | +RUN chmod +x /usr/local/bin/rr |
| 83 | +RUN rm -rf /tmp/roadrunner |
| 84 | + |
| 85 | +# Copy gRPC binaries and extension from grpc-base |
| 86 | +# COPY --from=grpc-base /github/grpc/cmake/build/third_party/protobuf/protoc /usr/local/bin/protoc |
| 87 | +# COPY --from=grpc-base /github/grpc/cmake/build/grpc_php_plugin /usr/local/bin/protoc-gen-grpc |
| 88 | +# COPY --from=grpc-base /usr/local/lib/php/extensions/no-debug-non-zts-20190902/grpc.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/grpc.so |
| 89 | + |
| 90 | +# # Enable grpc |
| 91 | +# RUN echo "extension=grpc.so" > /etc/php/8.4/cli/conf.d/20-grpc.ini |
| 92 | + |
| 93 | + |
| 94 | +RUN apt-get -y autoremove |
| 95 | +RUN apt-get clean |
| 96 | +RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
| 97 | + |
| 98 | +RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.4 |
| 99 | + |
| 100 | +RUN userdel -r ubuntu |
| 101 | +RUN groupadd --force -g $WWWGROUP sail |
| 102 | +RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail |
| 103 | + |
| 104 | +COPY ./.docker/start-container /usr/local/bin/start-container |
| 105 | +COPY ./.docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf |
| 106 | +COPY ./.docker/php.ini /etc/php/8.4/cli/conf.d/99-sail.ini |
| 107 | +RUN chmod +x /usr/local/bin/start-container |
| 108 | + |
| 109 | +EXPOSE 80/tcp 50051/tcp |
| 110 | + |
| 111 | +ENTRYPOINT ["start-container"] |
0 commit comments