diff --git a/Dockerfile b/Dockerfile index 7734ad3..e22bbe7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,14 +2,7 @@ FROM php:7.4-apache RUN apt-get update RUN apt-get install -y git -#RUN docker-php-ext-install mysqli -#RUN docker-php-ext-install json -#RUN docker-php-ext-install zip -#RUN docker-php-ext-install xml -#RUN docker-php-ext-install curl -#RUN docker-php-ext-install pdo -#RUN docker-php-ext-install pdo_mysql -#RUN docker-php-ext-install session +RUN docker-php-ext-install pdo_mysql RUN curl -sS https://getcomposer.org/installer -o composer-setup.php RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer @@ -21,6 +14,7 @@ COPY ./vhost.conf /etc/apache2/sites-available/000-default.conf WORKDIR /var/www/html RUN mkdir -p /var/www/html/var/sessions +RUN mkdir -p /var/www/html/var/logs RUN chown -R www-data:www-data /var/www/html RUN a2enmod rewrite diff --git a/app/Helper/Helper.php b/app/Helper/Helper.php index a2f1aef..8460b39 100644 --- a/app/Helper/Helper.php +++ b/app/Helper/Helper.php @@ -49,8 +49,8 @@ public static function getMessage() } } - public static function createZip($files = array(), $destination = '', $overwrite = false) { - + public static function createZip($files = array(), $destination = '', $overwrite = false) + { if (file_exists($destination) && !$overwrite) { return false; } diff --git a/bin/console b/bin/console index ac58360..467c16a 100644 --- a/bin/console +++ b/bin/console @@ -70,7 +70,7 @@ if ($climate->arguments->defined('help')) { * Correct database settings are required. */ if ($climate->arguments->defined('create-schema')) { - $sqlFile = 'etc/schema.sql'; + $sqlFile = 'etc/01-schema.sql'; if (!file_exists($sqlFile)) { $climate->red()->out('Schema file does not exist or could not be found!'); } diff --git a/config.yml b/config.yml index bcd2929..be3c40c 100644 --- a/config.yml +++ b/config.yml @@ -1,6 +1,6 @@ # site config site: - env: dev # dev/prod + env: prod # dev/prod name: WPCustomRepository operator: 1 default_locale: en @@ -20,7 +20,7 @@ cookie: database: driver: mysql # or sqlite (file needs to be set) host: db - port: 3316 + port: 3306 username: dbo password: test123 dbname: wpcr diff --git a/docker-compose.yml b/docker-compose.yml index 4098ec1..e49f165 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,16 +1,19 @@ -version: "2" +version: "3.9" services: php: build: . - container_name: wpcr_app + container_name: wpcr_php volumes: - ./:/var/www/html - /var/log/apache2/wpcr:/var/log/apache2 + - vardata:/var/www/html/var ports: - - "8000:80" + - "9727:80" depends_on: - db + networks: + wpcr_net: db: image: mysql:5.7 @@ -20,7 +23,14 @@ services: MYSQL_DATABASE: wpcr MYSQL_USER: dbo MYSQL_PASSWORD: test123 - ports: - - "3316:3306" volumes: - - "./etc/schema.sql:/docker-entrypoint-initdb.d/1.sql" \ No newline at end of file + - "./etc/sql:/docker-entrypoint-initdb.d" + networks: + wpcr_net: + +networks: + wpcr_net: + driver: bridge + +volumes: + vardata: \ No newline at end of file diff --git a/etc/schema.sql b/etc/sql/01-schema.sql similarity index 95% rename from etc/schema.sql rename to etc/sql/01-schema.sql index 915c46a..cdc61ea 100644 --- a/etc/schema.sql +++ b/etc/sql/01-schema.sql @@ -334,8 +334,6 @@ ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; COMMIT; -INSERT INTO `user` (`id`, `username`, `first_name`, `last_name`, `password`, `email`, `confirmation_token`, `confirmation_token_validity`, `last_login`, `locale`, `admin`, `locked`, `created_at`) VALUES - (1, 'test', 'John', 'Doe', '$2y$12$QH3n2eXBzdLB1kqdiXGbrO9m23HlxlzDj0vgW7zRMvOatRR7jdS7u', 'test@test.test', NULL, NULL, NULL, 'en', 1, 0, '2022-01-18 00:55:39'); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; diff --git a/etc/sql/02-data.sql b/etc/sql/02-data.sql new file mode 100644 index 0000000..3f7ca6b --- /dev/null +++ b/etc/sql/02-data.sql @@ -0,0 +1,4 @@ +USE wpcr; + +INSERT INTO `user` (`id`, `username`, `first_name`, `last_name`, `password`, `email`, `confirmation_token`, `confirmation_token_validity`, `last_login`, `locale`, `admin`, `locked`, `created_at`) VALUES + (1, 'test', 'John', 'Doe', '$2y$12$QH3n2eXBzdLB1kqdiXGbrO9m23HlxlzDj0vgW7zRMvOatRR7jdS7u', 'test@test.test', NULL, NULL, NULL, 'en', 1, 0, '2022-01-18 00:55:39');