Skip to content
Open
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
91 changes: 91 additions & 0 deletions apache.dev.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
FROM php:8.3-apache-bookworm

ENV OHRM_VERSION 5.7
ENV OHRM_MD5 5bd924a546e29e06c34eec73b014d139

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

RUN set -ex; \
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libfreetype6-dev \
libjpeg-dev \
libpng-dev \
libzip-dev \
libldap2-dev \
libicu-dev \
unzip \
curl \
; \
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs && \
npm install -g yarn && \
\
docker-php-ext-configure gd --with-freetype --with-jpeg; \
docker-php-ext-configure ldap \
--with-libdir=lib/$(uname -m)-linux-gnu/ \
; \
\
docker-php-ext-install -j "$(nproc)" \
gd \
opcache \
intl \
pdo_mysql \
zip \
ldap \
; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/cache/apt/archives; \
rm -rf /var/lib/apt/lists/*

RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
\
if command -v a2enmod; then \
a2enmod rewrite; \
fi;

RUN chown -R www-data:www-data /var/www/html && \
chmod -R 775 /var/www/html

# Installing dependencies with yarn

WORKDIR /app

# Copy only the package.json and yarn.lock files for each directory
COPY installer/client/package.json installer/client/yarn.lock ./installer/client/
COPY src/client/package.json src/client/yarn.lock ./src/client/
COPY src/test/functional/package.json src/test/functional/yarn.lock ./src/test/functional/

# Install dependencies for each specific directory
WORKDIR /app/installer/client
RUN yarn install

WORKDIR /app/src/client
RUN yarn install

WORKDIR /app/src/test/functional
RUN yarn install

# Set the final working directory back to the main app directory
WORKDIR /app

VOLUME ["/var/www/html"]
29 changes: 13 additions & 16 deletions apache.dockerfile → backup_original.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM php:8.3-apache-bookworm

#WORKDIR /app

ENV OHRM_VERSION 5.7
ENV OHRM_MD5 5bd924a546e29e06c34eec73b014d139

Expand All @@ -19,16 +17,17 @@ RUN set -ex; \
libicu-dev \
unzip \
; \
# cd .. && rm -r html; \
# curl -fSL -o orangehrm.zip "https://sourceforge.net/projects/orangehrm/files/stable/${OHRM_VERSION}/orangehrm-${OHRM_VERSION}.zip"; \
# echo "${OHRM_MD5} orangehrm.zip" | md5sum -c -; \
# unzip -q orangehrm.zip "orangehrm-${OHRM_VERSION}/*"; \
# mv orangehrm-$OHRM_VERSION html; \
# rm -rf orangehrm.zip; \
# chown www-data:www-data html; \
# chown -R www-data:www-data html/src/cache html/src/log html/src/config; \
# chmod -R 775 html/src/cache html/src/log html/src/config; \
# \
\
cd .. && rm -r html; \
curl -fSL -o orangehrm.zip "https://sourceforge.net/projects/orangehrm/files/stable/${OHRM_VERSION}/orangehrm-${OHRM_VERSION}.zip"; \
echo "${OHRM_MD5} orangehrm.zip" | md5sum -c -; \
unzip -q orangehrm.zip "orangehrm-${OHRM_VERSION}/*"; \
mv orangehrm-$OHRM_VERSION html; \
rm -rf orangehrm.zip; \
chown www-data:www-data html; \
chown -R www-data:www-data html/src/cache html/src/log html/src/config; \
chmod -R 775 html/src/cache html/src/log html/src/config; \
\
docker-php-ext-configure gd --with-freetype --with-jpeg; \
docker-php-ext-configure ldap \
--with-libdir=lib/$(uname -m)-linux-gnu/ \
Expand Down Expand Up @@ -70,8 +69,6 @@ RUN { \
a2enmod rewrite; \
fi;

WORKDIR /app

RUN chown -R www-data:www-data /var/www/html && \
chmod -R 775 /var/www/html

# VOLUME ["/var/www/html"]
VOLUME ["/var/www/html"]
24 changes: 13 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
services:

apache:
build:
context: .
Expand All @@ -9,12 +8,15 @@ services:
- 8099:80
- 4049:443
volumes:
- ./:/var/www/html
- ./:/app
- /app/installer/client/node_modules #do not map node_modules to the container (node_modules gererated for the container OS may have differences to my windows local node_modules)
- /app/src/client/node_modules
- /app/src/test/functional/node_modules
environment:
ORANGEHRM_DATABASE_HOST: '${DATABASE_HOST}'
ORANGEHRM_DATABASE_USER: '${DATABASE_USER}'
ORANGEHRM_DATABASE_PASSWORD: '${DATABASE_PASSWORD}'
ORANGEHRM_DATABASE_NAME: '${DATABASE_NAME}'
ORANGEHRM_DATABASE_HOST: "${DATABASE_HOST}"
ORANGEHRM_DATABASE_USER: "${DATABASE_USER}"
ORANGEHRM_DATABASE_PASSWORD: "${DATABASE_PASSWORD}"
ORANGEHRM_DATABASE_NAME: "${DATABASE_NAME}"
PUID: 998
PGID: 100
depends_on:
Expand All @@ -31,10 +33,10 @@ services:
volumes:
- ./db_orange:/var/lib/mysql
environment:
MYSQL_DATABASE: '${DATABASE_NAME}'
MYSQL_ROOT_USER: '${DATABASE_USER}'
MYSQL_PASSWORD: '${DATABASE_PASSWORD}'
MYSQL_ROOT_PASSWORD: '${DATABASE_PASSWORD}'
MYSQL_DATABASE: "${DATABASE_NAME}"
MYSQL_ROOT_USER: "${DATABASE_USER}"
MYSQL_PASSWORD: "${DATABASE_PASSWORD}"
MYSQL_ROOT_PASSWORD: "${DATABASE_PASSWORD}"

phpmyadmin:
image: phpmyadmin/phpmyadmin
Expand All @@ -48,7 +50,7 @@ services:
#PMA_USER: '${DATABASE_USER}'
#PMA_PASSWORD: '${DATABASE_PASSWORD}'
#MYSQL_ROOT_USER: root
MYSQL_ROOT_PASSWORD: '${DATABASE_PASSWORD}'
MYSQL_ROOT_PASSWORD: "${DATABASE_PASSWORD}"

volumes:
db_data:
6 changes: 4 additions & 2 deletions installer/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ function isInSupportedPHPRange()

$message = "PHP version should be higher than `$min` and lower than `$max`, detected version is `$currentVersion`.";

if (!(version_compare(trimVersion($currentVersion, substr_count($min, '.')), $min, '>=') &&
version_compare(trimVersion($currentVersion, substr_count($max, '.')), $max, '<='))) {
if (
!(version_compare(trimVersion($currentVersion, substr_count($min, '.')), $min, '>=') &&
version_compare(trimVersion($currentVersion, substr_count($max, '.')), $max, '<='))
) {
die($message);
}

Expand Down