CodeIgniter Forums
Spark on Docker not working - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Spark on Docker not working (/showthread.php?tid=92264)



Spark on Docker not working - lokischw - 01-02-2025

Hi Folks!
I'm trying to setup my application with CI 4.5 on docker, but when I try to migrate and seed nothing occurs. It just give me back an " " response. What am I missing? 

Here's my Dockerfile: 
Code:
FROM php:8.2.27-apache

RUN apt-get update && \
    apt-get install -y

RUN apt-get install -y curl vim wget git curl libgdal-dev \
    build-essential libssl-dev zlib1g-dev libpng-dev \
    libjpeg-dev libfreetype6-dev libonig-dev libicu-dev \
    libzip-dev unzip

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

COPY . /var/www/html

COPY /docker/000-default.conf /etc/apache2/sites-enabled/000-default.conf

RUN docker-php-ext-install mysqli pdo pdo_mysql mbstring gd intl zip && docker-php-ext-enable mysqli

RUN docker-php-ext-configure intl

RUN chown -R www-data:www-data /var/www/html && a2enmod rewrite && a2enmod headers proxy_http

RUN echo "upload_max_filesize = 100M" > /usr/local/etc/php/conf.d/uploads.ini

RUN echo "post_max_size = 100M" >> /usr/local/etc/php/conf.d/uploads.ini

RUN service apache2 restart

WORKDIR /var/www/html

USER www-data

EXPOSE 80
EXPOSE 443

and Here's my docker-compose: 
Code:
services:
  myservice:
    image: myimage:main
    command: bash -c "php spark migrate && php spark db:seed"
    restart: "unless-stopped"
    links:
      - dbservice
    ports:
      - "9000:80"
    environment:
      admin_name: "NAME"
      admin_email: "[email protected]"
      admin_password: "password"
      database_default_hostname: dbservice
      database_default_database: dbname
      database_default_username: root
      database_default_password: dbpw
      logger_threshold: 5
      app_baseURL: "http://localhost:9000"


  dbservice:
    image: mysql:latest
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: dbpw
      MYSQL_DATABASE: dbname
    ports:
      - "3306:3306"

And if I try to run spark on Vendor's folder, it works correctly. I've already tried to copy to my app base folder, but same result. What am I missing?


RE: Spark on Docker not working - lokischw - 01-03-2025

Solved by creating, in dockerfile, the following folders:

writable/logs
writable/cache
writable/session


RE: Spark on Docker not working - InsiteFX - 01-04-2025

Also if the folder is changed from default spark will not work unless you edit it and change the path to the new folder.