Sylius / ShopApiPlugin

Shop API for Sylius.
https://sylius.com
130 stars 89 forks source link

How to add the Api to Sylius/Docker? #282

Closed 2monkey closed 6 years ago

2monkey commented 6 years ago

This is my Dockerfile:

FROM sylius/nginx-php-fpm:latest
MAINTAINER Sylius Docker Team <docker@sylius.org>

ARG AS_UID=33

ENV SYLIUS_VERSION 1.1.1

ENV BASE_DIR /var/www
ENV SYLIUS_DIR ${BASE_DIR}/sylius

Modify UID of www-data into UID of local user

RUN usermod -u ${AS_UID} www-data

Operate as www-data in SYLIUS_DIR per default

WORKDIR ${BASE_DIR}

Create Sylius project

USER www-data
RUN composer create-project \
        sylius/sylius-standard \
        ${SYLIUS_DIR} \
        ${SYLIUS_VERSION} \
    && chmod +x sylius/bin/console \
    # Patch Sylius Standard from master (required for version < 1.1) \
    && cd sylius \
    && rm -f app/config/parameters.yml \
    && curl -o app/config/parameters.yml.dist https://raw.githubusercontent.com/Sylius/Sylius-Standard/master/app/config/parameters.yml.dist \
    && composer run-script post-install-cmd
USER root

nginx configuration

COPY nginx/nginx.conf /etc/nginx/nginx.conf

Install yarn

RUN curl -sS http://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb http://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN curl -sL http://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs
RUN apt-get install yarn

Yarn assets

RUN cd ${SYLIUS_DIR} \
&& yarn install && yarn run gulp

RUN chown -R www-data:www-data /var/www/sylius/web
RUN chmod 755 /var/www/sylius/web
lchrusciel commented 6 years ago

I don't have any knowledge about docker itself, but adding ShopApi should be pretty straightforward, as it shouldn't be required any additional config. Once you will create a project follow the installation instruction

2monkey commented 6 years ago

yeah - but composer cant install the plugin. Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "ShopApiPlugin" from namespace "Sylius\ShopApiPlugin".

this is my install in the project folder COMPOSER_MEMORY_LIMIT=-1 composer require "sylius/shop-api-plugin":"^1.0.0-beta.20"

PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 268435464 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSet.php on line 84

2monkey commented 6 years ago

Ok got it!