feat: Added Docker support

This commit is contained in:
Roman Kelesidis 2025-08-21 11:53:51 +03:00
commit 8440ecd29b
No known key found for this signature in database
GPG key ID: D8157C4D4C4C6DB4
2 changed files with 71 additions and 0 deletions

35
Dockerfile Normal file
View file

@ -0,0 +1,35 @@
FROM dunglas/frankenphp:1-php8.4
RUN apt-get update && apt-get install -y \
cron \
libicu-dev \
libtidy-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
libxml2-dev \
libzip-dev \
&& docker-php-ext-install -j$(nproc) \
mysqli \
mbstring \
gd \
bcmath \
intl \
tidy \
xml \
xmlwriter \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY . /app
RUN echo "*/10 * * * * php /app/cron.php >> /var/log/cron.log 2>&1" > /etc/cron.d/app-cron \
&& chmod 0644 /etc/cron.d/app-cron \
&& crontab /etc/cron.d/app-cron \
&& touch /var/log/cron.log
COPY install/Caddyfile /etc/caddy/Caddyfile
EXPOSE 80 443
CMD service cron start && frankenphp run --config /etc/caddy/Caddyfile

36
docker-compose.yml Normal file
View file

@ -0,0 +1,36 @@
version: "3.9"
services:
app:
build: .
container_name: php-app
ports:
- "${TP_PORT}:80"
env_file:
- .env
volumes:
- ./:/app
- ./internal_data:/app/internal_data
- ./data:/app/data
- ./sitemap:/app/sitemap
depends_on:
- db
db:
image: mariadb:10.11
container_name: db
restart: always
env_file:
- .env
environment:
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
MYSQL_DATABASE: ${DB_DATABASE}
MYSQL_USER: ${DB_USERNAME}
MYSQL_PASSWORD: ${DB_PASSWORD}
ports:
- "${DB_PORT}:3306"
volumes:
- db_data:/var/lib/mysql
volumes:
db_data: