-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-> Docker :)
- Loading branch information
Showing
14 changed files
with
204 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dockerfiles/mariadb/data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/storage/packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
FROM php:8.3-fpm | ||
|
||
WORKDIR /var/www/html | ||
|
||
# Install system dependencies and PHP extensions | ||
RUN apt-get update && apt-get install -y \ | ||
libpng-dev \ | ||
libjpeg-dev \ | ||
libfreetype6-dev \ | ||
libxml2-dev \ | ||
libzip-dev \ | ||
libonig-dev \ | ||
libcurl4-openssl-dev \ | ||
zip \ | ||
unzip \ | ||
git \ | ||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \ | ||
&& docker-php-ext-install \ | ||
gd \ | ||
pdo \ | ||
pdo_mysql \ | ||
mysqli \ | ||
bcmath \ | ||
xml \ | ||
mbstring \ | ||
curl \ | ||
zip | ||
|
||
# Install Composer | ||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer | ||
|
||
# Copy composer files first to leverage Docker cache | ||
COPY composer.json composer.lock ./ | ||
|
||
# Install dependencies | ||
RUN cd /var/www/html && COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --optimize-autoloader | ||
|
||
# Copy rest of the application | ||
COPY . . | ||
|
||
# Set permissions | ||
RUN chown -R www-data:www-data /var/www/html \ | ||
&& chmod -R 755 /var/www/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
use MythicalClient\Cli\App; | ||
define("ENV_PATH", __DIR__ . "/storage/"); | ||
define('APP_START', microtime(true)); | ||
define('APP_DIR', __DIR__ ); | ||
|
||
require_once __DIR__ . "/boot/kernel.php"; | ||
|
||
try { | ||
$args = array_slice($argv, 1); // Exclude the command name and the first argument | ||
new App(isset($argv[1]) ? $argv[1] : '', $args); | ||
} catch (Exception $e) { | ||
echo $e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
DATABASE_HOST=127.0.0.1 | ||
DATABASE_HOST=mythical_database | ||
DATABASE_PORT=3306 | ||
DATABASE_USER=mythical | ||
DATABASE_PASSWORD=efwefwefwe | ||
DATABASE_PASSWORD="Pizza2007!" | ||
DATABASE_DATABASE=mythicalclient | ||
DATABASE_ENCRYPTION=xchacha20 | ||
DATABASE_ENCRYPTION_KEY="zKZ7//AocUD2wCuzjW5rdTbb8FvGBgKTZ8iCATslZ/8=" | ||
DATABASE_ENCRYPTION_KEY="zKZ7//AocUD2wCuzjW5rdTbb8FvGBgKTZ8iCATslZ/8=" | ||
REDIS_PASSWORD="eufefwefwefw" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,90 @@ | ||
version: '3.8' | ||
|
||
services: | ||
php: | ||
# Frontend Vue service | ||
mythical_frontend: | ||
build: | ||
context: ./dockerfiles/php | ||
restart: unless-stopped | ||
context: ./frontend | ||
dockerfile: Dockerfile | ||
container_name: mythical_frontend | ||
volumes: | ||
- .:/var/www/ | ||
expose: | ||
- 9000 | ||
depends_on: | ||
database: | ||
condition: service_healthy | ||
env_file: ./backend/storage/.env | ||
extra_hosts: | ||
host.docker.internal: host-gateway | ||
- ./frontend:/app | ||
- /app/node_modules | ||
networks: | ||
- mythical_network | ||
|
||
frontend: | ||
build: | ||
context: . | ||
dockerfile: ./dockerfiles/frontend | ||
# PHP Backend service with PHP-FPM | ||
mythical_backend: | ||
build: | ||
context: ./backend | ||
dockerfile: Dockerfile | ||
container_name: mythical_backend | ||
volumes: | ||
- ./:/var/www/ | ||
restart: unless-stopped | ||
- ./backend:/var/www/html | ||
- ./backend/vendor:/var/www/html/vendor | ||
depends_on: | ||
- mythical_database | ||
networks: | ||
- mythical_network | ||
|
||
composer: | ||
image: composer:latest | ||
working_dir: /var/www/ | ||
# Main Nginx service | ||
mythical_nginx: | ||
image: nginx:alpine | ||
container_name: mythical_nginx | ||
ports: | ||
- "8080:80" | ||
volumes: | ||
- .:/var/www | ||
entrypoint: ["composer", "--ignore-platform-reqs", "--no-progress", "--no-dev", "--optimize-autoloader"] | ||
command: ["install"] | ||
|
||
database: | ||
image: mariadb:10.5 | ||
- ./backend:/var/www/html | ||
- ./framework.conf:/etc/nginx/conf.d/default.conf | ||
depends_on: | ||
- mythical_frontend | ||
- mythical_backend | ||
networks: | ||
- mythical_network | ||
|
||
mythical_database: | ||
image: mariadb:latest | ||
restart: unless-stopped | ||
container_name: mythical_database | ||
volumes: | ||
- ./dockerfiles/mariadb/data:/var/lib/mysql | ||
- ./dockerfiles/mariadb/data:/var/lib/mysql/ | ||
ports: | ||
- 3306:3306 | ||
- 33060:33060 | ||
env_file: | ||
- ./backend/storage/.env | ||
environment: | ||
MYSQL_RANDOM_ROOT_PASSWORD: "true" | ||
MARIADB_ROOT_PASSWORD: "superlongquiery!!password" | ||
MARIADB_DATABASE: ${DATABASE_DATABASE} | ||
MARIADB_USER: ${DATABASE_USER} | ||
MARIADB_PASSWORD: ${DATABASE_PASSWORD} | ||
MARIADB_PASSWORD: ${DATABASE_PASSWORD} | ||
healthcheck: | ||
test: mysqladmin ping -u$$MARIADB_USER -p$$MARIADB_PASSWORD | ||
interval: 5s | ||
timeout: 5s | ||
retries: 20 | ||
networks: | ||
- mythical_network | ||
|
||
mythical_redis: | ||
image: redis:7.0-alpine | ||
container_name: mythical_redis | ||
restart: unless-stopped | ||
command: redis-server --save 60 1 --loglevel notice --requirepass '${REDIS_PASSWORD}' | ||
env_file: | ||
- ./backend/storage/.env | ||
ports: | ||
- 6379:6379 | ||
environment: | ||
REDIS_PASSWORD: ${REDIS_PASSWORD} | ||
healthcheck: | ||
test: redis-cli -a $$REDIS_PASSWORD ping | grep PONG | ||
interval: 5s | ||
timeout: 5s | ||
retries: 20 | ||
networks: | ||
- mythical_network | ||
|
||
networks: | ||
mythical_network: | ||
driver: bridge |
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
server { | ||
listen 80; | ||
server_name framework.mythical.systems; | ||
|
||
# Root directory for PHP backend | ||
root /var/www/html/public; | ||
index index.php index.html index.htm; | ||
|
||
# Location for the PHP backend (handles all /api requests and PHP files) | ||
location /api { | ||
try_files $uri $uri/ /index.php; | ||
} | ||
|
||
# General PHP script handling (via PHP-FPM) | ||
location ~ \.php$ { | ||
include fastcgi_params; | ||
fastcgi_pass mythical_backend:9000; # PHP-FPM is running here | ||
fastcgi_index index.php; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
} | ||
|
||
# Location for the frontend | ||
location / { | ||
proxy_pass http://mythical_frontend:80; # Replace 'frontend:80' with your frontend service | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
} | ||
|
||
# Deny access to sensitive files | ||
location ~ /\.(ht|git|svn) { | ||
deny all; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Build stage | ||
FROM node:20 as build-stage | ||
WORKDIR /app | ||
COPY package*.json ./ | ||
RUN yarn install | ||
COPY . . | ||
RUN yarn run build | ||
|
||
# Production stage | ||
FROM nginx:alpine | ||
COPY --from=build-stage /app/dist /usr/share/nginx/html | ||
EXPOSE 80 | ||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters