Installing Sylius with Docker


#1

Hi everyone,

I just installed Sylius with Docker as described in the installation guide.

But as described in this issue I can’t find the Sylius code on my local machine. It only exists in the container. Due to this I can’t make any modification or extensions. Is this a fault in the Docker setup, or is this just me not understanding Docker? :wink:

But also depending to the point above, I also have the issue that no assets are loaded when I setup Sylius trough Docker. All the views are rendered, but no styles are applied. So - following the general Sylius setup guide - i’d run yarn run gulp but because I can’t find any Sylius code on my local machine, I can’t do that.

So I’m kinda stuck with this and it would be nice if you guys could provide me some more info on how this docker-setup works. Or where I can find the code on our local machine so I can start developing Sylius with Docker.

Thanks in advance!

Kind regards,

Lucas


#2

I think you don’t fully understand Docker. Sylius code is inside Docker container because of line 19-28 here https://github.com/Sylius/Docker/blob/master/Dockerfile. Try to run docker ps, take first three letters of Sylius container ID and execute docker exec -it XYZ bash and you are inside that container. Just imagine you are on another machine. Now you can run yarn or gulp. This approach is mainly used for production - one container with “all in” on cloud for example.

If you want to write your own code on your local machine and still use Docker, you have to attach volume to Docker container. But you have to write your own Dockerfile and docker-compose file. Just ping me on slack if you need help :slight_smile:


#3

After some chatting with @czende he provided me with the solution for the for the styles that are not loading. For people that are experiencing the same problem, you have to add this to the end of the .Dockerfile in the root of the project.

# 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

With the make up command Yarn & Gulp will be installed and the assets will be ‘gulped’

For the fact that I can’t find the code on my local machine I’m still trying to find a solution. But that’ll be for later.


#4

Make it with laradock. In this docker-compose you have workspace, which allow you to edit files on your computer (synchronized with files in docker).