Skip to content

Commit

Permalink
Added Docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianFun123 committed Jul 26, 2022
1 parent 7dbcec4 commit 9095d7e
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/cache

# ENVIRONMENT FILES
.env
.enva
.env.local
.env.production

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ ENV WEB_DOCUMENT_ROOT=/app/public
ENV WEB_DOCUMENT_INDEX=index.php

# Actually the default command
CMD supervisord
CMD php cli migrate:auto && supervisord
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ The ulole-framework is a highly customizable PHP-Framework.
- [ulole-orm](https://github.com/interaapps/ulole-orm)
- [deverm router](https://github.com/interaapps/deverm-router)

#### Installation
Copy / Clone this repo and
#### Create Project
```bash
# Uppm
php uppm.phar install
# Or Composer
composer install
# With UPPM
uppm create myapp interaapps/ulole-framework

# Or with Composer
composer create-project interaapps/ulole-framework myapp
```


## Example
#### `app\App.php`
```php
Expand All @@ -38,7 +39,7 @@ class App extends WebApplication {

public function init() : void {
$this->getConfig()
->loadENVFile(".env");
->loadENVFile(".enva");

// A ulole-framework helper for UloleORM::database("main", new Database(...))
$this->initDatabase(/*Config prefix*/ "database", "main");
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "interaapps/ulole-framework",
"version": "3.3.1",
"require": {
"interaapps/ulole": "3.1.1"
"interaapps/ulole": "=3.1.4"
},
"autoload": {
"psr-4": {
Expand Down
32 changes: 32 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: '3.3'

services:
db:
image: mariadb:latest
volumes:
- myappdbvol:/var/lib/mysql

environment:
MYSQL_ROOT_PASSWORD: myapp
MYSQL_DATABASE: myapp
MYSQL_USER: myapp
MYSQL_PASSWORD: myapp

myapp:
build: .

depends_on:
- db
ports:
- "820:80"

environment:
DATABASE_DRIVER: mysql
DATABASE_DATABASE: myapp
DATABASE_USERNAME: myapp
DATABASE_PASSWORD: myapp
DATABASE_SERVER: db
DATABASE_PORT: 3306

volumes:
myappdbvol:
3 changes: 2 additions & 1 deletion src/main/com/example/myproject/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ public function __construct() {
*/
public function init() : void{
$this->getConfig()
->loadENV() // Loads environment variables
// If the file doesn't exists it'll just ignore it without any exception!
->loadPHPFile("env.php") // Uses the returned array in a php file
->loadENVFile(".env") // A simple .env file
->loadENVFile(".enva") // A simple .enva file
->loadJSONFile("env.json"); // Using a json file

$this->initDatabase(/*Config prefix*/ "database" /*, "main" (Default) */);
Expand Down
2 changes: 0 additions & 2 deletions src/main/com/example/myproject/helper/cli/CustomCLI.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<?php
namespace com\example\myproject\helper\cli;

use com\example\myproject\model\User;
use de\interaapps\ulole\core\cli\CLI;
use de\interaapps\ulole\core\cli\CLIHandler;
use de\interaapps\ulole\core\cli\Colors;

class CustomCLI extends CLIHandler {
public function registerCommands(CLI $cli){
$cli->register("test", function($args){

Colors::info("This is an example :) ".(isset($args[2]) ? $args[2] : "Arg not set") /* STARTING POINT (first argument) */);
});
}
Expand Down
4 changes: 2 additions & 2 deletions uppm.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "ulole-framework",
"version": "3.1.1",
"version": "3.3.1",
"description": "",
"author": "",
"keywords": [],
"modules": {
"ulole-core": "3.1.1"
"ulole-core": "3.1.4"
},
"run": {
"cli": "cli"
Expand Down

0 comments on commit 9095d7e

Please sign in to comment.