From f98e707faf00fb2f530c827d47ab84591c6d3169 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 11 Jun 2026 11:29:08 +0700 Subject: [PATCH] fix : add dockerfile --- 01/.dockerignore | 15 ++++++++++ 01/Dockerfile | 45 ++++++++++++++++++++++++++++++ 01/docker-compose.yml | 64 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 01/.dockerignore create mode 100644 01/Dockerfile create mode 100644 01/docker-compose.yml diff --git a/01/.dockerignore b/01/.dockerignore new file mode 100644 index 0000000..8f5e623 --- /dev/null +++ b/01/.dockerignore @@ -0,0 +1,15 @@ +node_modules +npm-debug.log +.git +.gitignore +README.md +QUICK_START.md +.DS_Store +*.swp +*.swo +*~ +.vscode +.idea +docker-compose.yml +Dockerfile +.dockerignore diff --git a/01/Dockerfile b/01/Dockerfile new file mode 100644 index 0000000..dcdc8f5 --- /dev/null +++ b/01/Dockerfile @@ -0,0 +1,45 @@ +# Use official PHP image with Apache +FROM php:8.1-apache + +# Set working directory +WORKDIR /var/www/html + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + mysql-client \ + git \ + curl \ + zip \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +# Enable Apache modules +RUN a2enmod rewrite \ + && a2enmod headers + +# Install PHP extensions +RUN docker-php-ext-install \ + mysqli \ + pdo \ + pdo_mysql + +# Set PHP configuration +RUN echo "display_errors = On" >> /usr/local/etc/php/conf.d/php.ini \ + && echo "error_reporting = E_ALL" >> /usr/local/etc/php/conf.d/php.ini \ + && echo "date.timezone = Asia/Jakarta" >> /usr/local/etc/php/conf.d/php.ini + +# Copy project files +COPY . . + +# Set permissions +RUN chown -R www-data:www-data /var/www/html + +# Expose port 80 +EXPOSE 80 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ + CMD curl -f http://localhost/ || exit 1 + +# Start Apache +CMD ["apache2-foreground"] diff --git a/01/docker-compose.yml b/01/docker-compose.yml new file mode 100644 index 0000000..a7a135d --- /dev/null +++ b/01/docker-compose.yml @@ -0,0 +1,64 @@ +version: '3.8' + +services: + # PHP-Apache Web Server + web: + build: . + container_name: webgis_web + ports: + - "8080:80" + volumes: + - .:/var/www/html + environment: + - APP_ENV=development + depends_on: + - mysql + networks: + - webgis_network + restart: unless-stopped + + # MySQL Database + mysql: + image: mysql:8.0 + container_name: webgis_mysql + environment: + MYSQL_ROOT_PASSWORD: root_password + MYSQL_DATABASE: pemetaan_kemiskinan + MYSQL_USER: webgis_user + MYSQL_PASSWORD: webgis_password + ports: + - "3306:3306" + volumes: + - mysql_data:/var/lib/mysql + - ./database.sql:/docker-entrypoint-initdb.d/database.sql + networks: + - webgis_network + restart: unless-stopped + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] + interval: 10s + timeout: 5s + retries: 5 + + # phpMyAdmin for database management + phpmyadmin: + image: phpmyadmin:latest + container_name: webgis_phpmyadmin + environment: + PMA_HOST: mysql + PMA_USER: root + PMA_PASSWORD: root_password + ports: + - "8081:80" + depends_on: + - mysql + networks: + - webgis_network + restart: unless-stopped + +volumes: + mysql_data: + +networks: + webgis_network: + driver: bridge