Files
UAS_SIG/Dockerfile
T

45 lines
1.2 KiB
Docker

# =========================================================
# Dockerfile - WebGIS PHP Application
# Nginx + PHP-FPM on Alpine (managed by entrypoint shell script)
# =========================================================
FROM php:8.2-fpm-alpine
# Install Nginx and required PHP extensions
RUN apk add --no-cache nginx \
&& docker-php-ext-install mysqli pdo pdo_mysql \
&& docker-php-ext-enable mysqli pdo_mysql
# CRITICAL: Allow ENV vars from Coolify (DB_HOST, DB_PASS, etc.)
# to be readable via getenv() in PHP. PHP-FPM strips env vars by default.
RUN echo "" >> /usr/local/etc/php-fpm.d/www.conf \
&& echo "[www]" >> /usr/local/etc/php-fpm.d/www.conf \
&& echo "clear_env = no" >> /usr/local/etc/php-fpm.d/www.conf
# Copy Nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf
# Create nginx runtime directories
RUN mkdir -p /run/nginx && \
mkdir -p /var/log/nginx
# Copy entrypoint script and make executable
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Set working directory
WORKDIR /var/www/html
# Copy all application files
COPY . .
# Set correct permissions
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html
# Expose port 80
EXPOSE 80
# Run entrypoint script
CMD ["/entrypoint.sh"]