Dockerfile 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. FROM ubuntu:24.04
  2. LABEL maintainer="Taylor Otwell"
  3. ARG WWWGROUP
  4. ARG NODE_VERSION=22
  5. ARG POSTGRES_VERSION=17
  6. WORKDIR /var/www/html
  7. ENV DEBIAN_FRONTEND=noninteractive
  8. ENV TZ=UTC
  9. ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80"
  10. ENV SUPERVISOR_PHP_USER="sail"
  11. RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
  12. RUN echo "Acquire::http::Pipeline-Depth 0;" > /etc/apt/apt.conf.d/99custom && \
  13. echo "Acquire::http::No-Cache true;" >> /etc/apt/apt.conf.d/99custom && \
  14. echo "Acquire::BrokenProxy true;" >> /etc/apt/apt.conf.d/99custom
  15. RUN apt-get update && apt-get upgrade -y \
  16. && mkdir -p /etc/apt/keyrings \
  17. && 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 \
  18. && curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xb8dc7e53946656efbce4c1dd71daeaab4ad4cab6' | gpg --dearmor | tee /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \
  19. && echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
  20. && apt-get update \
  21. && apt-get install -y php8.1-cli php8.1-dev \
  22. php8.1-pgsql php8.1-sqlite3 php8.1-gd php8.1-imagick \
  23. php8.1-curl php8.1-mongodb \
  24. php8.1-imap php8.1-mysql php8.1-mbstring \
  25. php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap \
  26. php8.1-intl php8.1-readline \
  27. php8.1-ldap \
  28. php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole \
  29. php8.1-memcached php8.1-pcov php8.1-xdebug \
  30. && curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
  31. && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
  32. && 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 \
  33. && apt-get update \
  34. && apt-get install -y nodejs \
  35. && npm install -g npm \
  36. && npm install -g bun \
  37. && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarn.gpg >/dev/null \
  38. && echo "deb [signed-by=/usr/share/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
  39. && curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null \
  40. && echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt noble-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
  41. && apt-get update \
  42. && apt-get install -y yarn \
  43. && apt-get install -y mysql-client \
  44. && apt-get install -y postgresql-client-$POSTGRES_VERSION \
  45. && apt-get -y autoremove \
  46. && apt-get clean \
  47. && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  48. RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.1
  49. RUN userdel -r ubuntu
  50. RUN groupadd --force -g $WWWGROUP sail
  51. RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
  52. COPY start-container /usr/local/bin/start-container
  53. COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
  54. COPY php.ini /etc/php/8.1/cli/conf.d/99-sail.ini
  55. RUN chmod +x /usr/local/bin/start-container
  56. EXPOSE 80/tcp
  57. ENTRYPOINT ["start-container"]