Skip to content

Instantly share code, notes, and snippets.

@ossentoo
Last active December 12, 2021 17:48
Show Gist options
  • Save ossentoo/5b8e490bbd5d9743b0b472fe751e7ae0 to your computer and use it in GitHub Desktop.
Save ossentoo/5b8e490bbd5d9743b0b472fe751e7ae0 to your computer and use it in GitHub Desktop.
# syntax=docker/dockerfile:experimental
FROM node:14.10-slim AS npm_builder
WORKDIR /frontend
COPY package.json package-lock.json webpack.mix.js composer.json \
composer.lock server.js server.php sshd_config ssh_setup.sh /frontend/
COPY resources/ /frontend/resources/
COPY config/ /config/
COPY app/ /app/
COPY bootstrap/cache/ bootstrap/app.php /bootstrap/
RUN npm install \
&& npm run production
FROM php:7.3-fpm
WORKDIR /web
ENV ACCEPT_EULA=Y
# Fix debconf warnings upon build
ARG DEBIAN_FRONTEND=noninteractive
# Install powershell
RUN apt update \
&& apt install -y wget apt-transport-https software-properties-common \
&& wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& apt-get update \
&& apt install -y powershell
# Install selected extensions and other stuff
RUN apt-get update \
&& apt-get -y install git \
&& apt-get -y --no-install-recommends install apt-utils libxml2-dev gnupg apt-transport-https \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
# Install MS ODBC Driver for SQL Server
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list
# MS sql/obbc driver dependencies
RUN apt update && apt install wget -y \
&& wget http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/multiarch-support_2.27-3ubuntu1.4_amd64.deb \
&& apt install ./multiarch-support_2.27-3ubuntu1.4_amd64.deb \
&& apt update && apt-get -y --no-install-recommends install msodbcsql17 unixodbc-dev
# Install sql server drivers
RUN pecl install sqlsrv \
&& pecl install pdo_sqlsrv \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
COPY custom/php-custom.ini /usr/local/etc/php/php.ini
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
COPY composer.json composer.lock /web/
COPY database/ /web/database/
COPY . /web/
COPY .env.local /web/.env
RUN --mount=type=cache,target=/var/composer composer install \
--no-interaction \
--no-plugins \
--no-scripts \
--no-dev \
--prefer-dist
RUN composer dump-autoload \
&& composer update
COPY --from=npm_builder /frontend/ /
COPY artisan package.json package-lock.json /
COPY pipelines/templates/powershell/UpdateEnvProperties.ps1 /files/
# Copy the sshd_config file to the /etc/ssh/ directory
COPY sshd_config /etc/ssh/
# Open port 8888 for web access
EXPOSE 8888
COPY /docker/start.ps1 /files/start.ps1
CMD ["pwsh", "/files/start.ps1"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment