compose project

This commit is contained in:
2025-10-29 21:22:20 +01:00
parent 36a794bbd8
commit ba7616e4fa
8 changed files with 143 additions and 5 deletions

8
.env Normal file
View File

@@ -0,0 +1,8 @@
# Domeny
DOMAIN=helpdesk.local.example.com
# Baza danych
MYSQL_ROOT_PASSWORD=rootpass123
MYSQL_DATABASE=helpdesk
MYSQL_USER=helpdesk
MYSQL_PASSWORD=helpdesk123

55
Dockerfile Normal file
View File

@@ -0,0 +1,55 @@
FROM php:8.4-fpm-alpine
LABEL maintainer="Kacper Żbikowski <mail@kzbikowski.pl>"
# Ustawienia środowiska
ENV DEBIAN_FRONTEND=noninteractive
# Aktualizacja systemu i instalacja zależności systemowych
RUN apt-get update && apt-get install -y \
libldap2-dev \
libpq-dev \
libzip-dev \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libicu-dev \
libonig-dev \
sendmail \
git \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Konfiguracja i instalacja rozszerzeń PHP
RUN docker-php-ext-configure ldap --with-ldap=/usr \
&& docker-php-ext-install ldap pdo pdo_mysql pdo_pgsql intl mbstring zip gd
# Instalacja Composera (globalnie)
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# Instalacja PHPMailer (lub innego mailera) globalnie
RUN composer global require phpmailer/phpmailer
# Dodanie ścieżki do Composer bin do PATH
ENV PATH="/root/.composer/vendor/bin:${PATH}"
# Skopiowanie plików aplikacji
WORKDIR /var/www/html
COPY . /var/www/html
# Uprawnienia (dla PHP-FPM)
RUN chown -R www-data:www-data /var/www/html
# Opcjonalne ustawienia PHP (uploady, timezone itd.)
RUN { \
echo "upload_max_filesize=20M"; \
echo "post_max_size=25M"; \
echo "memory_limit=512M"; \
echo "date.timezone=Europe/Warsaw"; \
} > /usr/local/etc/php/conf.d/custom.ini
# Ekspozycja portu PHP-FPM
EXPOSE 9000
# Uruchomienie procesu PHP-FPM
CMD ["php-fpm"]

View File

@@ -201,8 +201,4 @@ Route::prefix('api/v1')->group(function(){
* Wygenerować gotowy plik routingu `routes/web.php` dla Laravel/Lumen.
* Przygotować specyfikację API (OpenAPI/Swagger) dla `api/v1`.
* Wygenerować przykładowe kontrolery i middleware skeletony.
---
Jeżeli chcesz, w następnym kroku wygeneruję konkretną implementację routingu dla wybranego frameworka (np. Laravel, Slim, Symfony).
* Wygenerować przykładowe kontrolery i middleware skeletony.

55
compose.yaml Normal file
View File

@@ -0,0 +1,55 @@
version: "3.9"
services:
mariadb:
image: mariadb
container_name: helpdesk-db
env_file:
- .env
volumes:
- ./mariadb:/var/lib/mysql
- ./initdb:/docker-entrypoint-initdb.d
networks:
- internal
restart: unless-stopped
labels:
- com.centurylinklabs.watchtower.enable=true
nginx:
image: nginx:stable-alpine
container_name: helpdesk-nginx
depends_on:
- php
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
- ./src:/var/www/html
networks:
- internal
- traefik_proxy
labels:
- traefik.enable=true
- traefik.docker.network=traefik_public
- traefik.http.routers.helpdesk.rule=Host(`${DOMAIN}`)
- traefik.http.routers.helpdesk.entrypoints=websecure
- traefik.http.routers.helpdesk.tls=true
- traefik.http.routers.helpdesk.tls.certresolver=tls-resolver
- com.centurylinklabs.watchtower.enable=true
restart: unless-stopped
php:
build:
context: .
dockerfile: Dockerfile
container_name: helpdesk-php
env_file:
- .env
volumes:
- ./src:/var/www/html
networks:
- internal
restart: unless-stopped
networks:
internal:
traefik_proxy:
external: true

View File

View File

View File

@@ -0,0 +1,2 @@
#!/bin/bash
echo ">>> Wykonuję dodatkową inicjalizację..."

22
nginx/conf.d Normal file
View File

@@ -0,0 +1,22 @@
server {
listen 80;
server_name _;
root /var/www/html/public;
index index.php index.html;
location / {
try_files $uri /index.php?$query_string;
}
location ~ \\.php$ {
include fastcgi_params;
fastcgi_pass php:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
}
location ~ /\\.ht {
deny all;
}
}