Dockerfile 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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.0-cli php8.0-dev \
  22. php8.0-pgsql php8.0-sqlite3 php8.0-gd php8.0-imagick \
  23. php8.0-curl php8.0-memcached php8.0-mongodb \
  24. php8.0-imap php8.0-mysql php8.0-mbstring \
  25. php8.0-xml php8.0-zip php8.0-bcmath php8.0-soap \
  26. php8.0-intl php8.0-readline php8.0-pcov \
  27. php8.0-msgpack php8.0-igbinary php8.0-ldap \
  28. php8.0-redis php8.0-swoole php8.0-xdebug \
  29. && curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
  30. && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
  31. && 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 \
  32. && apt-get update \
  33. && apt-get install -y nodejs \
  34. && npm install -g npm \
  35. && npm install -g bun \
  36. && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null \
  37. && echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
  38. && curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null \
  39. && 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 \
  40. && apt-get update \
  41. && apt-get install -y yarn \
  42. && apt-get install -y mysql-client \
  43. && apt-get install -y postgresql-client-$POSTGRES_VERSION \
  44. && apt-get -y autoremove \
  45. && apt-get clean \
  46. && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  47. RUN update-alternatives --set php /usr/bin/php8.0
  48. RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.0
  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.0/cli/conf.d/99-sail.ini
  55. RUN chmod +x /usr/local/bin/start-container
  56. EXPOSE 80/tcp
  57. ENTRYPOINT ["start-container"]