Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Git files
.git
.gitignore
.github

# Documentation
README.md
AUTHORS
LICENSE
*.md

# Development files
vagrant/
INSTALL/
.idea
.vscode
.DS_Store

# Dependencies (will be installed in container)
vendor/
node_modules/

# Data directories (will be mounted as volumes)
data/

# Build artifacts
public/css/
public/js/
public/img/
public/flags/
public/views/

# Logs
*.log
npm-debug.log

# Cache
*.cache
.docker-initialized

# Environment files (should be configured separately)
.env
.env.dev
16 changes: 16 additions & 0 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# MariaDB Configuration
DBPASSWORD_ADMIN=root
DBNAME_COMMON=monarc_common
DBNAME_MASTER=monarc_master
DBUSER_MONARC=sqlmonarcuser
DBPASSWORD_MONARC=sqlmonarcuser

# Optional: set to 0/false/no to disable Xdebug in the image build
XDEBUG_ENABLED=1
XDEBUG_MODE=debug
XDEBUG_START_WITH_REQUEST=trigger
# On Linux, set XDEBUG_CLIENT_HOST to your Docker bridge (often 172.17.0.1).
XDEBUG_CLIENT_HOST=host.docker.internal
XDEBUG_CLIENT_PORT=9003
XDEBUG_IDEKEY=IDEKEY
XDEBUG_DISCOVER_CLIENT_HOST=0
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ bin/
data/*
vagrant/.vagrant/
vagrant/*.log
.env
.docker-initialized
docker/db_data
58 changes: 58 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Chrome",
"port": 9222,
"request": "attach",
"type": "chrome",
"webRoot": "${workspaceFolder}"
},
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html/monarc": "${workspaceFolder}"
}
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 0,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
},
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"localhost:0"
],
"program": "",
"cwd": "${workspaceRoot}",
"port": 9003,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
}
]
}
112 changes: 112 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
FROM ubuntu:22.04

ARG XDEBUG_ENABLED=1
ARG XDEBUG_MODE=debug
ARG XDEBUG_START_WITH_REQUEST=trigger
ARG XDEBUG_CLIENT_HOST=host.docker.internal
ARG XDEBUG_CLIENT_PORT=9003
ARG XDEBUG_IDEKEY=IDEKEY
ARG XDEBUG_DISCOVER_CLIENT_HOST=0

# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
ENV LANGUAGE=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8

# Install system dependencies
RUN apt-get update && apt-get upgrade -y && \
packages="vim zip unzip git gettext curl gsfonts mariadb-client apache2 php8.1 php8.1-cli \
php8.1-common php8.1-mysql php8.1-zip php8.1-gd php8.1-mbstring php8.1-curl php8.1-xml \
php8.1-bcmath php8.1-intl php8.1-imagick locales wget ca-certificates gnupg"; \
if [ "$XDEBUG_ENABLED" = "1" ] || [ "$XDEBUG_ENABLED" = "true" ] || [ "$XDEBUG_ENABLED" = "yes" ]; then \
packages="$packages php8.1-xdebug"; \
fi; \
apt-get install -y $packages && \
locale-gen en_US.UTF-8 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Configure PHP
RUN sed -i 's/upload_max_filesize = .*/upload_max_filesize = 200M/' /etc/php/8.1/apache2/php.ini && \
sed -i 's/post_max_size = .*/post_max_size = 50M/' /etc/php/8.1/apache2/php.ini && \
sed -i 's/max_execution_time = .*/max_execution_time = 100/' /etc/php/8.1/apache2/php.ini && \
sed -i 's/max_input_time = .*/max_input_time = 223/' /etc/php/8.1/apache2/php.ini && \
sed -i 's/memory_limit = .*/memory_limit = 512M/' /etc/php/8.1/apache2/php.ini && \
sed -i 's/session\\.gc_maxlifetime = .*/session.gc_maxlifetime = 604800/' /etc/php/8.1/apache2/php.ini && \
sed -i 's/session\\.gc_probability = .*/session.gc_probability = 1/' /etc/php/8.1/apache2/php.ini && \
sed -i 's/session\\.gc_divisor = .*/session.gc_divisor = 1000/' /etc/php/8.1/apache2/php.ini

# Configure Xdebug for development
RUN if [ "$XDEBUG_ENABLED" = "1" ] || [ "$XDEBUG_ENABLED" = "true" ] || [ "$XDEBUG_ENABLED" = "yes" ]; then \
echo "zend_extension=xdebug.so" > /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
echo "xdebug.mode=${XDEBUG_MODE}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
echo "xdebug.start_with_request=${XDEBUG_START_WITH_REQUEST}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
echo "xdebug.client_host=${XDEBUG_CLIENT_HOST}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
echo "xdebug.client_port=${XDEBUG_CLIENT_PORT}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
echo "xdebug.discover_client_host=${XDEBUG_DISCOVER_CLIENT_HOST}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini && \
echo "xdebug.idekey=${XDEBUG_IDEKEY}" >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini; \
fi

# Enable Apache modules
RUN a2enmod rewrite ssl headers

# Set global ServerName to avoid AH00558 warning
RUN echo "ServerName localhost" > /etc/apache2/conf-available/servername.conf \
&& a2enconf servername

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Install Node.js and npm
RUN mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" > /etc/apt/sources.list.d/nodesource.list && \
apt-get update && \
apt-get install -y nodejs && \
npm install -g grunt-cli && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /var/www/html/monarc

# Configure Apache
RUN echo '<VirtualHost *:80>\n\
ServerName localhost\n\
DocumentRoot /var/www/html/monarc/public\n\
\n\
<Directory /var/www/html/monarc/public>\n\
DirectoryIndex index.php\n\
AllowOverride All\n\
Require all granted\n\
</Directory>\n\
\n\
<IfModule mod_headers.c>\n\
Header always set X-Content-Type-Options nosniff\n\
Header always set X-XSS-Protection "1; mode=block"\n\
Header always set X-Robots-Tag none\n\
Header always set X-Frame-Options SAMEORIGIN\n\
</IfModule>\n\
\n\
SetEnv APP_ENV development\n\
SetEnv APP_DIR /var/www/html/monarc\n\
</VirtualHost>' > /etc/apache2/sites-available/000-default.conf

# Allow Apache override to all
RUN sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf

# Create necessary directories
RUN mkdir -p /var/www/html/monarc/data/cache \
/var/www/html/monarc/data/LazyServices/Proxy \
/var/www/html/monarc/data/DoctrineORMModule/Proxy \
/var/www/html/monarc/data/import/files

# Copy entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh

EXPOSE 80

ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["apachectl", "-D", "FOREGROUND"]
Loading
Loading