diff --git a/apps/akeneo/.env b/apps/akeneo/.env index f94e6cccb..0463010d1 100644 --- a/apps/akeneo/.env +++ b/apps/akeneo/.env @@ -1,19 +1,19 @@ -W9_VERSION=v7.0.22 -W9_DIST=community +W9_VERSION='v7.0.22' +W9_DIST='community' W9_REPO = websoft9dev/akeneo -W9_POWER_PASSWORD=UGz0IARz117ssO% +W9_POWER_PASSWORD='l3Of!CFkf8r!EhyI' #### -- Not allowed to edit below environments when recreate app based on existing data -- #### -W9_ID=akeneo_z4oyc +W9_ID='akeneo_z4oyc' W9_HTTP_PORT=80 -W9_HTTP_PORT_SET=9001 +W9_HTTP_PORT_SET='9001' W9_LOGIN_USER=admin W9_LOGIN_PASSWORD=$W9_POWER_PASSWORD W9_NETWORK=websoft9 W9_DB_EXPOSE="mysql" W9_MYSQL_VERSION="8.0" W9_ES_VERSION="7.10.1" -W9_URL=appname.example.com +W9_URL='appname.example.com' #### ------------------------------------------------------------------------------------------ #### AKENEO_MYSQL_DATABASE=${W9_ID} @@ -22,4 +22,4 @@ AKENEO_MYSQL_PASSWORD=${W9_POWER_PASSWORD} AKENEO_MYSQL_HOST=$W9_ID-mysql AKENEO_SITENAME="akeneo" AKENEO_ADMIN_USER=${W9_LOGIN_USER} -AKENEO_ADMIN_PASSWORD=${W9_POWER_PASSWORD} \ No newline at end of file +AKENEO_ADMIN_PASSWORD=${W9_POWER_PASSWORD} diff --git a/apps/akeneo/src/Dockerfile b/apps/akeneo/src/Dockerfile new file mode 100644 index 000000000..429fe5456 --- /dev/null +++ b/apps/akeneo/src/Dockerfile @@ -0,0 +1,47 @@ +# refer to: https://github.com/chandrantwins/akeneo-docker/blob/master/Dockerfile +# akeneo version: https://packagist.org/packages/akeneo/pim-community-standard +# upgrade to: 7.0.23 + +FROM akeneo/pim-php-dev:8.1 + +LABEL maintainer="help@websoft9.com" +LABEL version="7.0.23" +LABEL description="Akeneo" + +ENV AKENEO_MYSQL_HOST=mysql +ENV AKENEO_MYSQL_PORT=3306 +ENV AKENEO_MYSQL_USER=akeneo +ENV AKENEO_MYSQL_PASSWORD=akeneo +ENV AKENEO_MYSQL_DATABASE=akeneo +ENV AKENEO_ADMIN_USER=admin +ENV AKENEO_ADMIN_PASSWORD=admin + + +RUN apt update -y && apt install apache2 unzip make -y +RUN apt clean && rm -rf /var/lib/apt/lists/* +RUN a2enmod rewrite proxy_fcgi actions alias expires headers ssl +ADD 000-default.conf /etc/apache2/sites-available/000-default.conf +ADD entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh && \ + sed -i "s#memory_limit = .*.M#memory_limit = 1024M#g" /etc/php/8.1/fpm/php.ini && \ + sed -i "s#listen = .*#listen = /run/php/php8.1-fpm.sock#g" /etc/php/8.1/fpm/pool.d/www.conf + +ENTRYPOINT ["/entrypoint.sh"] + + +RUN curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh +RUN bash nodesource_setup.sh && apt install nodejs && npm install -g yarn +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer +RUN rm -rf /var/www/html/* +RUN COMPOSER_MEMORY_LIMIT=-1 && \ + composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ && \ + composer create-project akeneo/pim-community-standard /var/www/html + +WORKDIR /var/www/html +RUN chown -R www-data:www-data /var/www/html +RUN yarn install +RUN PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 yarnpkg packages:build + +EXPOSE 80 + +CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] diff --git a/apps/akeneo/src/entrypoint.sh b/apps/akeneo/src/entrypoint.sh new file mode 100755 index 000000000..196c52ad5 --- /dev/null +++ b/apps/akeneo/src/entrypoint.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +localexist=/var/www/html/.env.local +if [ ! -e "$localexist" ]; then + + echo "file:.env.local isn't exist" + + # replace Akeneo env + cp /var/www/html/.env /var/www/html/.env.local + sed -i "s/APP_DATABASE_HOST=.*/APP_DATABASE_HOST=$AKENEO_MYSQL_HOST/g" /var/www/html/.env.local + sed -i "s/APP_DATABASE_PORT=.*/APP_DATABASE_PORT=$AKENEO_MYSQL_PORT/g" /var/www/html/.env.local + sed -i "s/APP_DATABASE_NAME=.*/APP_DATABASE_NAME=$AKENEO_MYSQL_DATABASE/g" /var/www/html/.env.local + sed -i "s/APP_DATABASE_USER=.*/APP_DATABASE_USER=$AKENEO_MYSQL_USER/g" /var/www/html/.env.local + sed -i "s/APP_DATABASE_PASSWORD=.*/APP_DATABASE_PASSWORD=$AKENEO_MYSQL_PASSWORD/g" /var/www/html/.env.local + + # to do: make prod + cd /var/www/html && NO_DOCKER=true make prod + chown -R www-data:www-data /var/www/html + + # create administrator credential + bin/console pim:user:create $AKENEO_ADMIN_USER $AKENEO_ADMIN_PASSWORD support@example.com Admin Admin en_US --admin -n --env=prod + + # Add local user + # Either use the LOCAL_USER_ID if passed in at runtime or + # fallback + + USER_ID=${LOCAL_USER_ID:-1000} + usermod -u $USER_ID -o www-data && groupmod -g $USER_ID -o www-data +else + echo "file:.env.local is exist." +fi + +/etc/init.d/php8.1-fpm start +exec "$@"