-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (31 loc) · 1.17 KB
/
Dockerfile
File metadata and controls
42 lines (31 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Use PHP 8.2 with Apache
FROM php:8.2-apache
# Install system dependencies, MongoDB extension, and unzip (for composer)
RUN apt-get update && apt-get install -y libssl-dev unzip git curl \
&& pecl install mongodb \
&& docker-php-ext-enable mongodb \
&& a2enmod rewrite
# Install Composer globally
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Set working directory
WORKDIR /var/www/html
# Copy only composer files first (caching benefit)
COPY composer.json composer.lock ./
# Install PHP dependencies inside container
RUN composer install --no-dev --optimize-autoloader
# Copy rest of the project (excluding local vendor/)
COPY . .
# Ensure uploads folders exist and are writable
RUN mkdir -p uploads/announcements \
&& mkdir -p uploads/residents \
&& mkdir -p uploads/officials \
&& chmod -R 777 uploads
# Suppress Apache ServerName warning
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
# Copy startup script
COPY start-apache.sh /start-apache.sh
RUN chmod +x /start-apache.sh
# Expose default port (Railway overrides $PORT automatically)
EXPOSE 80
# Start Apache
CMD ["/start-apache.sh"]