2024-12-19 21:10:00 -06:00
|
|
|
FROM php:8.3-fpm
|
|
|
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
2025-01-26 20:40:44 -06:00
|
|
|
ENV APP_NAME=Investbrain
|
2025-01-26 21:38:59 -06:00
|
|
|
ENV VITE_APP_NAME=Investbrain
|
2025-01-26 11:20:52 -06:00
|
|
|
ENV APP_DEBUG=true
|
|
|
|
|
ENV SELF_HOSTED=true
|
2024-12-19 21:10:00 -06:00
|
|
|
|
|
|
|
|
# Set the working directory
|
|
|
|
|
COPY . /var/www/app
|
|
|
|
|
WORKDIR /var/www/app
|
|
|
|
|
|
2025-01-27 13:23:00 -06:00
|
|
|
# Allow PHP installs to be built cross-platform
|
2025-01-27 14:26:40 -06:00
|
|
|
#ENV CFLAGS="-fstack-protector-strong -fpic -fPIC -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
|
2025-01-27 13:03:13 -06:00
|
|
|
|
2025-01-27 11:06:58 -06:00
|
|
|
# Install required packages
|
2025-01-27 11:55:18 -06:00
|
|
|
RUN apt-get update && apt-get upgrade -y \
|
2025-01-27 12:48:16 -06:00
|
|
|
&& apt-get upgrade -y \
|
2025-01-25 18:09:02 -06:00
|
|
|
nginx \
|
2024-12-19 21:53:50 -06:00
|
|
|
libfreetype-dev \
|
|
|
|
|
libjpeg62-turbo-dev \
|
|
|
|
|
libpng-dev \
|
|
|
|
|
zlib1g-dev \
|
|
|
|
|
libzip-dev \
|
|
|
|
|
libicu-dev \
|
2025-01-26 23:48:24 -06:00
|
|
|
libpq-dev \
|
2025-01-27 12:48:16 -06:00
|
|
|
binutils libc6-dev \
|
2024-12-19 21:53:50 -06:00
|
|
|
supervisor \
|
2025-01-27 12:48:16 -06:00
|
|
|
unzip curl git \
|
2025-01-27 11:06:58 -06:00
|
|
|
nodejs npm \
|
|
|
|
|
# Clean up APT
|
|
|
|
|
&& apt-get -y autoremove \
|
|
|
|
|
&& apt-get clean \
|
2025-01-27 12:48:16 -06:00
|
|
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
|
|
|
|
# Install PHP extensions
|
|
|
|
|
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
|
|
|
|
&& docker-php-ext-install -j$(nproc) \
|
|
|
|
|
gd pgsql zip pdo_mysql mysqli intl
|
2025-01-26 21:06:08 -06:00
|
|
|
|
|
|
|
|
# Set permissions
|
|
|
|
|
RUN chown -R www-data:www-data . \
|
|
|
|
|
&& chmod -R 775 ./storage \
|
|
|
|
|
&& chmod +x ./docker/entrypoint.sh \
|
|
|
|
|
&& usermod -s /bin/bash www-data
|
2025-01-25 18:09:02 -06:00
|
|
|
|
2025-01-27 11:06:58 -06:00
|
|
|
# Install Composer and Node.js Install PHP dependencies and build front end assets
|
|
|
|
|
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
|
|
|
|
|
&& composer install --no-scripts --optimize-autoloader \
|
2025-01-26 20:40:44 -06:00
|
|
|
&& npm install && npm run build
|
2025-01-25 18:22:12 -06:00
|
|
|
|
2025-01-26 21:06:08 -06:00
|
|
|
# Remove default nginx config
|
|
|
|
|
RUN rm /etc/nginx/sites-enabled/default
|
|
|
|
|
|
2025-01-25 20:40:26 -06:00
|
|
|
# Copy over configs
|
2025-01-25 18:09:02 -06:00
|
|
|
COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf
|
2024-12-19 21:10:00 -06:00
|
|
|
COPY ./docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
|
|
|
|
|
|
|
|
# Serve on port 80
|
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
|
|
# Set up healthcheck
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD curl -f http://localhost || exit 1
|
|
|
|
|
|
|
|
|
|
# Run everything else
|
|
|
|
|
ENTRYPOINT ["/bin/bash", "./docker/entrypoint.sh"]
|
2025-01-25 21:53:55 -06:00
|
|
|
|