83 lines
2.1 KiB
Docker
83 lines
2.1 KiB
Docker
# Use the official PHP 8.4 FPM image
|
|
FROM php:8.4-fpm
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
git \
|
|
curl \
|
|
libpng-dev \
|
|
libonig-dev \
|
|
libxml2-dev \
|
|
libzip-dev \
|
|
libicu-dev \
|
|
zip \
|
|
unzip \
|
|
nginx \
|
|
supervisor \
|
|
libmemcached-dev \
|
|
zlib1g-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install PHP extensions
|
|
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip intl
|
|
RUN pecl install memcached redis \
|
|
&& docker-php-ext-enable memcached redis
|
|
|
|
# Install Composer
|
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
|
|
# Install Node.js
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
|
&& apt-get install -y nodejs
|
|
|
|
# Install Bun
|
|
RUN curl -fsSL https://bun.com/install | bash
|
|
ENV PATH="/root/.bun/bin:${PATH}"
|
|
|
|
# Install memcached and redis servers
|
|
RUN apt-get update && apt-get install -y memcached redis-server && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy application files
|
|
COPY . /app/.
|
|
|
|
# Create necessary directories
|
|
RUN mkdir -p /var/log/nginx && mkdir -p /var/cache/nginx
|
|
|
|
# Install PHP dependencies
|
|
RUN composer install --no-dev --optimize-autoloader
|
|
|
|
# Install Node.js dependencies
|
|
RUN bun install --frozen-lockfile
|
|
|
|
# Build assets with HIDE_AUTH_BUTTONS=false so Wayfinder generates all routes
|
|
# (HIDE_AUTH_BUTTONS will be set to true at runtime via .env)
|
|
RUN HIDE_AUTH_BUTTONS=false bun run build:ssr
|
|
|
|
# Copy supervisor configuration
|
|
COPY docker/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
|
|
# Copy nginx configuration
|
|
COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf
|
|
|
|
# Set permissions
|
|
RUN chown -R www-data:www-data /app \
|
|
&& chmod -R 755 /app/storage \
|
|
&& chmod -R 755 /app/bootstrap/cache
|
|
|
|
# Expose port
|
|
EXPOSE 80
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
|
CMD curl -f http://localhost/up || exit 1
|
|
|
|
# Copy entrypoint script
|
|
COPY docker/entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
# Run entrypoint script (handles migrations, caching, then starts supervisor)
|
|
CMD ["/entrypoint.sh"]
|