Skip to content

Instantly share code, notes, and snippets.

@bubba-h57
Created February 7, 2022 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bubba-h57/270a7c9a5f753aa22808e16338dffced to your computer and use it in GitHub Desktop.
Save bubba-h57/270a7c9a5f753aa22808e16338dffced to your computer and use it in GitHub Desktop.
Modifications to the 8.0 Sail Dockerfile for more functionality as a .devcontainer.
FROM ubuntu:21.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=16
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 \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 \
&& mkdir -p ~/.gnupg \
&& chmod 600 ~/.gnupg \
&& echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \
&& apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C \
&& apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C \
&& echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu hirsute main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php8.0-cli php8.0-dev \
php8.0-pgsql php8.0-sqlite3 php8.0-gd \
php8.0-curl php8.0-memcached \
php8.0-imap php8.0-mysql php8.0-mbstring \
php8.0-xml php8.0-zip php8.0-bcmath php8.0-soap \
php8.0-intl php8.0-readline php8.0-pcov \
php8.0-msgpack php8.0-igbinary php8.0-ldap \
php8.0-redis php8.0-swoole php8.0-xdebug \
&& php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y mysql-client \
&& apt-get install -y postgresql-client \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN update-alternatives --set php /usr/bin/php8.0
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.0
RUN groupadd --force -g $WWWGROUP sail
##################### Start Bubba's Edits ##########################################
WORKDIR /tmp
# Just remove 8.1 entirely, lest it cause some confusion later.
RUN apt remove -y php8.1*
# We are installing the MS SQL Server PHP extensions, so we need this first.
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/ubuntu/21.04/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get -qq install -y --no-install-recommends msodbcsql17 unixodbc-dev \
&& ACCEPT_EULA=Y apt-get -qq install -y mssql-tools \
&& apt-get -qq install -y build-essential gcc musl-dev make expect autoconf automake valgrind wget zlib1g-dev
# Pick needs these enabled in order to run
RUN phpenmod -v 8.0 mbstring simplexml dom
RUN wget https://github.com/FriendsOfPHP/pickle/releases/latest/download/pickle.phar
RUN chmod +x pickle.phar
RUN php pickle.phar install sqlsrv && echo "extension=sqlsrv.so" >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-sqlsrv.ini
RUN php pickle.phar install pdo_sqlsrv && echo "extension=pdo_sqlsrv.so" >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-pdo_sqlsrv.ini
# And now we can enable the MS SQL extensions, whoot
RUN phpenmod -v 8.0 sqlsrv pdo_sqlsrv \
&& rm -rf /tmp/* /var/tmp/*
RUN apt-get -qq install -y neovim zsh powerline fonts-powerline
# Make ZSH our default shell
RUN useradd -ms /usr/bin/zsh --no-user-group -g $WWWGROUP -u 1337 sail
USER sail
RUN /bin/sh -c "$(curl -fsSL raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
USER root
WORKDIR /var/www/html
##################### End Bubba's Edits ##########################################
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.0/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 8000
WORKDIR /var/www/html
ENTRYPOINT ["start-container"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment