Skip to content

Commit 5918cd5

Browse files
author
Dmytro Lukianenko
committed
create docker image dmi3yy/evolution-cms
1 parent 47be709 commit 5918cd5

2 files changed

Lines changed: 68 additions & 41 deletions

File tree

.dockerignore

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
.gitattributes
55

66
# Docker
7-
Dockerfile
7+
Dockerfile*
88
.dockerignore
9-
docker-compose.yml
10-
docker-compose.*.yml
9+
docker-compose*
1110

1211
# Documentation
1312
README.md
@@ -19,46 +18,45 @@ docs/
1918
.vscode/
2019
*.swp
2120
*.swo
21+
*~
2222

23-
# OS
23+
# OS generated files
2424
.DS_Store
25+
.DS_Store?
26+
._*
27+
.Spotlight-V100
28+
.Trashes
29+
ehthumbs.db
2530
Thumbs.db
2631

2732
# Logs
2833
*.log
2934
logs/
3035

31-
# Temporary files
36+
# Cache and temporary files
37+
.cache/
3238
tmp/
3339
temp/
3440
.tmp/
3541

36-
# Node.js (if any)
42+
# Node modules (if any)
3743
node_modules/
38-
npm-debug.log
39-
yarn-error.log
44+
npm-debug.log*
4045

41-
# PHP
42-
.phpunit.result.cache
43-
phpunit.xml
44-
45-
# Environment files
46-
.env
47-
.env.*
46+
# Vendor directories (will be rebuilt in container)
47+
vendor/
48+
core/vendor/
4849

49-
# Backup files
50-
*.bak
51-
*.backup
52-
*.sql
50+
# Lock files (problematic for Docker builds)
51+
composer.lock
52+
core/composer.lock
5353

54-
# Cache directories
55-
core/storage/cache/*
56-
core/storage/logs/*
57-
core/storage/sessions/*
58-
assets/cache/*
59-
!core/storage/.gitkeep
60-
!assets/cache/.gitkeep
54+
# Test files
55+
tests/
56+
phpunit.xml*
57+
.phpunit.result.cache
6158

62-
# Vendor (will be installed during build)
63-
# core/vendor/
64-
# vendor/
59+
# CI/CD
60+
.github/
61+
.gitlab-ci.yml
62+
.travis.yml

Dockerfile

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
FROM php:8.4-apache
1+
FROM php:8.2-apache
22

3-
# System deps and PHP extensions
3+
# Install system dependencies first
4+
RUN apt-get update && apt-get install -y \
5+
ca-certificates \
6+
curl \
7+
gnupg \
8+
lsb-release \
9+
&& apt-get clean \
10+
&& rm -rf /var/lib/apt/lists/*
11+
12+
# Install required system packages and development libraries
413
RUN apt-get update && apt-get install -y \
514
libfreetype6-dev \
615
libjpeg62-turbo-dev \
@@ -9,11 +18,21 @@ RUN apt-get update && apt-get install -y \
918
libpq-dev \
1019
libxml2-dev \
1120
libicu-dev \
21+
libonig-dev \
22+
libcurl4-openssl-dev \
23+
pkg-config \
24+
libssl-dev \
1225
unzip \
1326
git \
1427
netcat-openbsd \
15-
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
28+
wget \
29+
&& apt-get clean \
30+
&& rm -rf /var/lib/apt/lists/*
31+
32+
# Configure and install PHP extensions
33+
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
1634
&& docker-php-ext-configure intl \
35+
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
1736
&& docker-php-ext-install -j$(nproc) \
1837
gd \
1938
mysqli \
@@ -29,26 +48,36 @@ RUN apt-get update && apt-get install -y \
2948
iconv \
3049
intl \
3150
opcache \
51+
curl \
52+
fileinfo \
53+
exif \
3254
&& a2enmod rewrite \
33-
&& apt-get clean \
34-
&& rm -rf /var/lib/apt/lists/*
55+
&& a2enmod headers
3556

3657
# Composer (use official image for better security)
3758
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
3859

39-
# App files
60+
# Set working directory
4061
WORKDIR /var/www/html
62+
63+
# Copy application files (excluding lock files via .dockerignore)
4164
COPY . /var/www/html
4265

66+
# Install composer dependencies (update to get latest compatible versions)
67+
RUN if [ -f composer.json ]; then \
68+
composer update --no-dev --prefer-dist --no-interaction --optimize-autoloader || true; \
69+
fi \
70+
&& if [ -f core/composer.json ]; then \
71+
cd core && composer update --no-dev --prefer-dist --no-interaction --optimize-autoloader && cd ..; \
72+
fi
73+
4374
# PHP configuration
4475
COPY docker/php.ini /usr/local/etc/php/conf.d/40-custom.ini
4576

46-
# Build-time Composer optimisation (root if needed, then core)
47-
RUN if [ -f composer.json ]; then composer install --no-dev --prefer-dist --no-interaction --optimize-autoloader; fi \
48-
&& if [ -f core/composer.json ]; then cd core && composer install --no-dev --prefer-dist --no-interaction --optimize-autoloader && cd - >/dev/null; fi
49-
50-
# Permissions (safe defaults; override in runtime if needed)
51-
RUN chown -R www-data:www-data storage core/storage assets \
77+
# Create necessary directories and set permissions
78+
RUN mkdir -p storage core/storage assets/cache assets/export assets/files assets/images \
79+
&& chown -R www-data:www-data storage core/storage assets \
80+
&& chmod -R 755 storage core/storage assets \
5281
|| true
5382

5483
ENV APACHE_DOCUMENT_ROOT=/var/www/html

0 commit comments

Comments
 (0)