Created
October 17, 2023 17:11
-
-
Save sloan58/cc9cc697cfb71f257bbaa3d4384bcf88 to your computer and use it in GitHub Desktop.
Laravel Sail with SQL Server (ubuntu 22.04 and php 8.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
FROM ubuntu:22.04 | |
LABEL maintainer="Taylor Otwell" | |
ARG WWWGROUP | |
ARG NODE_VERSION=18 | |
ARG POSTGRES_VERSION=15 | |
WORKDIR /var/www/html | |
ENV DEBIAN_FRONTEND noninteractive | |
ENV TZ=UTC | |
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |
RUN apt-get update \ | |
&& mkdir -p /etc/apt/keyrings \ | |
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils librsvg2-bin fswatch \ | |
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \ | |
&& echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ | |
&& apt-get update \ | |
&& apt-get install -y php8.1-cli php8.1-dev \ | |
php8.1-pgsql php8.1-sqlite3 php8.1-gd php8.1-imagick \ | |
php8.1-curl \ | |
php8.1-imap php8.1-mysql php8.1-mbstring \ | |
php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap \ | |
php8.1-intl php8.1-readline \ | |
php8.1-ldap \ | |
php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole \ | |
php8.1-memcached php8.1-pcov php8.1-xdebug \ | |
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \ | |
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ | |
&& 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 \ | |
&& apt-get update \ | |
&& apt-get install -y nodejs \ | |
&& npm install -g npm \ | |
&& npm install -g bun \ | |
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarn.gpg >/dev/null \ | |
&& echo "deb [signed-by=/usr/share/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ | |
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null \ | |
&& echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ | |
&& apt-get update \ | |
&& apt-get install -y yarn \ | |
&& apt-get install -y mysql-client \ | |
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \ | |
&& apt-get install -y unixodbc-dev \ | |
&& curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc \ | |
&& curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list | tee /etc/apt/sources.list.d/mssql-release.list \ | |
&& apt-get update \ | |
&& ACCEPT_EULA=Y apt-get install -y msodbcsql18 \ | |
&& pecl install sqlsrv pdo_sqlsrv \ | |
&& apt-get -y autoremove \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
RUN printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/8.1/mods-available/sqlsrv.ini | |
RUN printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/8.1/mods-available/pdo_sqlsrv.ini | |
RUN phpenmod sqlsrv pdo_sqlsrv | |
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.1 | |
RUN groupadd --force -g $WWWGROUP sail | |
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail | |
COPY start-container /usr/local/bin/start-container | |
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf | |
COPY php.ini /etc/php/8.1/cli/conf.d/99-sail.ini | |
RUN chmod +x /usr/local/bin/start-container | |
EXPOSE 8000 | |
ENTRYPOINT ["start-container"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment