2023-09-08 16:44:03 +00:00
|
|
|
ARG PHP_PACKAGES="php8.2 composer php8.2-common php8.2-pgsql php8.2-redis php8.2-mbstring\
|
|
|
|
php8.2-simplexml php8.2-bcmath php8.2-gd php8.2-curl php8.2-zip\
|
|
|
|
php8.2-imagick php8.2-bz2 php8.2-gmp php8.2-int php8.2-pcov php8.2-soap php8.2-xsl"
|
2023-07-27 09:34:19 +00:00
|
|
|
|
|
|
|
FROM node:16 AS javascript-builder
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# It's best to add as few files as possible before running the build commands
|
|
|
|
# as they will be re-run everytime one of those files changes.
|
|
|
|
#
|
|
|
|
# It's possible to run npm install with only the package.json and package-lock.json file.
|
|
|
|
|
|
|
|
ADD package.json package-lock.json ./
|
|
|
|
RUN npm install
|
|
|
|
|
|
|
|
ADD resources /app/resources
|
|
|
|
ADD public /app/public
|
|
|
|
ADD tailwind.config.js vite.config.js postcss.config.js /app/
|
|
|
|
RUN npm run build
|
|
|
|
|
|
|
|
|
|
|
|
# syntax=docker/dockerfile:1.3-labs
|
|
|
|
FROM --platform=linux/amd64 ubuntu:23.04 AS php-dependency-installer
|
|
|
|
|
|
|
|
ARG PHP_PACKAGES
|
|
|
|
|
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install -y $PHP_PACKAGES composer
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
ADD composer.json composer.lock artisan ./
|
|
|
|
# Running artisan requires the full php app to be installed so we need to remove the
|
|
|
|
# post-autoload command from the composer file if we want to run composer without
|
|
|
|
# adding a dependency to all the php files.
|
|
|
|
RUN sed 's_@php artisan package:discover_/bin/true_;' -i composer.json
|
|
|
|
RUN composer install
|
|
|
|
|
|
|
|
ADD app /app/app
|
|
|
|
ADD bootstrap /app/bootstrap
|
|
|
|
ADD config /app/config
|
|
|
|
ADD database /app/database
|
|
|
|
ADD public public
|
|
|
|
ADD routes routes
|
|
|
|
ADD tests tests
|
|
|
|
|
|
|
|
# Manually run the command we deleted from composer.json earlier
|
|
|
|
RUN php artisan package:discover --ansi
|
|
|
|
|
|
|
|
|
|
|
|
FROM --platform=linux/amd64 ubuntu:23.04
|
|
|
|
|
|
|
|
# supervisord is a process manager which will be responsible for managing the
|
|
|
|
# various server processes. These are configured in docker/supervisord.conf
|
|
|
|
|
|
|
|
CMD ["/usr/bin/supervisord"]
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
ARG PHP_PACKAGES
|
|
|
|
|
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install -y \
|
|
|
|
supervisor nginx sudo postgresql-15 redis\
|
2023-09-08 16:44:03 +00:00
|
|
|
$PHP_PACKAGES php8.2-fpm\
|
2023-07-27 09:34:19 +00:00
|
|
|
&& apt-get clean
|
|
|
|
|
|
|
|
ADD docker/postgres-wrapper.sh docker/php-fpm-wrapper.sh docker/redis-wrapper.sh /usr/local/bin/
|
2023-09-08 16:44:03 +00:00
|
|
|
ADD docker/php-fpm.conf /etc/php/8.2/fpm/pool.d/
|
2023-07-27 09:34:19 +00:00
|
|
|
ADD docker/nginx.conf /etc/nginx/sites-enabled/default
|
|
|
|
ADD docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
|
|
ADD .env.docker .env
|
|
|
|
|
|
|
|
ADD . .
|
|
|
|
|
|
|
|
COPY --from=javascript-builder /app/public/build/ ./public/build/
|
|
|
|
COPY --from=php-dependency-installer /app/vendor/ ./vendor/
|
|
|
|
|
|
|
|
RUN chmod a+x /usr/local/bin/*.sh /app/artisan \
|
|
|
|
&& ln -s /app/artisan /usr/local/bin/artisan \
|
|
|
|
&& useradd opnform \
|
|
|
|
&& echo "daemon off;" >> /etc/nginx/nginx.conf\
|
|
|
|
&& echo "daemonize no" >> /etc/redis/redis.conf\
|
|
|
|
&& echo "appendonly yes" >> /etc/redis/redis.conf\
|
|
|
|
&& echo "dir /persist/redis/data" >> /etc/redis/redis.conf
|
2023-09-08 16:44:03 +00:00
|
|
|
|
2023-07-27 09:34:19 +00:00
|
|
|
|
|
|
|
EXPOSE 80
|