diff --git a/.gitignore b/.gitignore index 8aadd85700..95c15cd146 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.env .idea .vscode lib/confs/ @@ -13,3 +14,4 @@ coverage/ src/plugins/orangehrmFunctionalTestingPlugin .php-cs-fixer.cache .php-cs-fixer.php +db_orange/ \ No newline at end of file diff --git a/apache.dockerfile b/apache.dockerfile new file mode 100644 index 0000000000..399975961d --- /dev/null +++ b/apache.dockerfile @@ -0,0 +1,77 @@ +FROM php:8.3-apache-bookworm + +#WORKDIR /app + +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 \ + ; \ + # 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/ \ + ; \ + \ + 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 + +# VOLUME ["/var/www/html"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..6fd47652d7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,54 @@ +services: + + apache: + build: + context: . + dockerfile: apache.dockerfile + env_file: .env + ports: + - 8099:80 + - 4049:443 + volumes: + - ./:/var/www/html + environment: + 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: + - mariadb + links: + - mariadb:mariadb + + mariadb: + image: mariadb:10.2 + #restart: unless-stopped + env_file: .env + ports: + - 3306:3306 + 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}' + + phpmyadmin: + image: phpmyadmin/phpmyadmin + depends_on: + - mariadb + ports: + - "8084:80" + env_file: .env + environment: + PMA_HOST: mariadb + #PMA_USER: '${DATABASE_USER}' + #PMA_PASSWORD: '${DATABASE_PASSWORD}' + #MYSQL_ROOT_USER: root + MYSQL_ROOT_PASSWORD: '${DATABASE_PASSWORD}' + +volumes: + db_data: diff --git a/installer/client/.prettierrc.js b/installer/client/.prettierrc.js index 5c4de1a4f6..aa3dadefcb 100644 --- a/installer/client/.prettierrc.js +++ b/installer/client/.prettierrc.js @@ -3,4 +3,5 @@ module.exports = { jsxBracketSameLine: true, singleQuote: true, trailingComma: 'all', + endOfLine: 'auto' }; diff --git a/readme_dependencies.txt b/readme_dependencies.txt new file mode 100644 index 0000000000..6e00b1f371 --- /dev/null +++ b/readme_dependencies.txt @@ -0,0 +1,23 @@ +Instalar dependencias do orangeHRM localmente: + +./src folder: + composer install --no-suggest + (If needed) -> composer update + +installer/client folder: + yarn install + yarn build / yarn dev + +src/client folder: + yarn install + yarn build / yarn dev + +Se der erros de prettier (formatação e eslint), executar comando: + yarn eslint --fix src/ + +Nos 3 ficheiros .prettier adicionar a linha: + endOfLine: 'auto' + +Docker: + + docker-compose run -d --build \ No newline at end of file diff --git a/src/client/.prettierrc.js b/src/client/.prettierrc.js index 5c4de1a4f6..aa3dadefcb 100644 --- a/src/client/.prettierrc.js +++ b/src/client/.prettierrc.js @@ -3,4 +3,5 @@ module.exports = { jsxBracketSameLine: true, singleQuote: true, trailingComma: 'all', + endOfLine: 'auto' }; diff --git a/src/test/functional/.prettierrc.js b/src/test/functional/.prettierrc.js index 5c4de1a4f6..aa3dadefcb 100644 --- a/src/test/functional/.prettierrc.js +++ b/src/test/functional/.prettierrc.js @@ -3,4 +3,5 @@ module.exports = { jsxBracketSameLine: true, singleQuote: true, trailingComma: 'all', + endOfLine: 'auto' };