Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation request #1

Open
sivajik34 opened this issue Oct 6, 2016 · 13 comments
Open

Documentation request #1

sivajik34 opened this issue Oct 6, 2016 · 13 comments

Comments

@sivajik34
Copy link

I forked the repo,then i cloned to my local,then I checkout to 2.1 branch by fetching the original repo.
I renamed to docker-compose.yml .
Now i ran docker-compose up -d .
Now what are the steps needed to run the magento in host browser?
Can you add documentation?

@sivajik34
Copy link
Author

I ran docker ps command.
after that i used web container with install-magento command.
it showing an error like no such file .
so now i ran docker exex -it container-id /bin/bash

sh /usr/local/bin/install-magento
now its working fine.
Note: i'm using windows 10 as a host.I want to edit files from host.can you help me on this?
really confusion on docker volumes part.

@alexcheng1982
Copy link
Owner

I don't have a Windows 10 machine, you can refer to this page on how to edit the host file.

If you are using the new native docker client (not Boot2Docker), you can modify the host file by adding this (not tested):

127.0.0.1 local.magento

@alexcheng1982
Copy link
Owner

For documentation, you can see my Magento 1.x repo. These two follow the same instructions.

@sivajik34
Copy link
Author

sivajik34 commented Oct 7, 2016

Can you give me some direction to edit magento source code from host editor for example using net beans?
and I want to commit the code to github/gitlab.
I mean i want to work with docker.It shouldn't be only for demo purpose.
Is it really useful in development environment?
In my office 1 designer(windows),1 tester(windows),2 developers(ubuntu),1 lead(windows),1 project manager(mac).
I don't have proper idea utilizing docker.but in everywhere present technology trending topic is docker.Really it will save the time?
Thanks in advance.

@sivajik34
Copy link
Author

sivajik34 commented Oct 7, 2016

windows mounting not working.its throwing an error like composer.json not found when i'm trying to build.
do you have any idea ? what is the issue.

in appdata folder I placed my code.and i commented some lines like downloading code from github,and moving code to container.

FROM alexcheng/apache2-php7

MAINTAINER Fu Cheng <alexcheng1982@gmail.com>

RUN a2enmod rewrite

# ENV MAGENTO_VERSION 2.1.1

# RUN rm -rf /var/www/html/*
# RUN cd /tmp && curl https://codeload.github.com/magento/magento2/tar.gz/$MAGENTO_VERSION -o $MAGENTO_VERSION.tar.gz && tar xvf $MAGENTO_VERSION.tar.gz && mv magento2-$MAGENTO_VERSION/* magento2-$MAGENTO_VERSION/.htaccess /var/www/html

RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
RUN requirements="libpng12-dev libmcrypt-dev libmcrypt4 libcurl3-dev libfreetype6 libjpeg-turbo8 libjpeg-turbo8-dev libpng12-dev libfreetype6-dev libicu-dev libxslt1-dev" \
    && apt-get update && apt-get install -y $requirements && rm -rf /var/lib/apt/lists/* \
    && docker-php-ext-install pdo_mysql \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install gd \
    && docker-php-ext-install mcrypt \
    && docker-php-ext-install mbstring \
    && docker-php-ext-install zip \
    && docker-php-ext-install intl \
    && docker-php-ext-install xsl \
    && docker-php-ext-install soap \
    && requirementsToRemove="libpng12-dev libmcrypt-dev libcurl3-dev libpng12-dev libfreetype6-dev libjpeg-turbo8-dev" \
    && apt-get purge --auto-remove -y $requirementsToRemove

COPY ./auth.json /var/www/.composer/
RUN chsh -s /bin/bash www-data
RUN chown -R www-data:www-data /var/www
RUN su www-data -c "cd /var/www/html && composer install"
RUN cd /var/www/html \
    && find . -type d -exec chmod 770 {} \; \
    && find . -type f -exec chmod 660 {} \; \
    && chmod u+x bin/magento

COPY ./bin/install-magento /usr/local/bin/install-magento
RUN chmod +x /usr/local/bin/install-magento

COPY ./bin/install-sampledata /usr/local/bin/install-sampledata
RUN chmod +x /usr/local/bin/install-sampledata

RUN echo "memory_limit=1024M" > /usr/local/etc/php/conf.d/memory-limit.ini

RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

WORKDIR /var/www/html

VOLUME /var/www/html/var
VOLUME /var/www/html/pub

# Add cron job
ADD crontab /etc/cron.d/magento2-cron
RUN chmod 0644 /etc/cron.d/magento2-cron
RUN crontab -u www-data /etc/cron.d/magento2-cron

version: '2'
services:
  web:
    build: .
    ports:
      - "81:80"
    volumes:
      - '/c/Users/Admin/docker-magento2/appdata:/var/www/html/'
    links:
      - db
    env_file:
      - env
  db:
    image: mysql:5.6.23
    volumes_from:
      - dbdata
    env_file:
      - env
  dbdata:
    image: alexcheng/data
    volumes:
      - /var/lib/mysql
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: phpmyadmin
    ports:
      - "8580:80"
    links:
      - db       


@alexcheng1982
Copy link
Owner

You shouldn't mount the whole Magento source directory, because you don't need to modify source code of core Magento files. You just need to mount your own extension/theme code. For example, if you are developing a theme,

volumes:
  - ./dev/theme:/var/www/html/app/design/frontend/mytheme/default

@le-ecalahorra
Copy link

Hello,

Following this issue; I'm agreed we don't need to mount the whole Magento Soruce; but would be nice to have the whole code in a host folder in order to run PhpStorm Project and debug whatever is necessary.

I tried to add the volume: "- ./src:/var/www/html" and I had the same poblem as @sivajik34.

Any solution?

@ioan-ghisoi
Copy link

Sry for the very general question but can I run this on circle ci? I mean how do i start it?

@alexcheng1982
Copy link
Owner

alexcheng1982 commented Nov 30, 2017 via email

@murnun
Copy link

murnun commented Dec 22, 2017

@alexcheng1982 - Completely agree on not touching core files but any recommendation as to how we can setup our IDE and XDebugger etc for full development workflow?

@victorw999
Copy link

victorw999 commented Jan 8, 2018

RE: Previous Comment

I don't have a Windows 10 machine, you can refer to this page on how to edit the host file.
If you are using the new native docker client (not Boot2Docker), you can modify the host file by adding this (not tested):

127.0.0.1 local.magento

This is what i did with "Windows-10-Home" and "Docker Toolbox":

  1. Verify docker IP: docker-machine ip
    say the output is 192.168.99.100
  2. Update Window host file: c:\windows\system32\drivers\etc\hosts
    add line 192.168.99.100 local.magento
  3. launch website from browser http:\\local.magento
    launch phpmyadmin via http:\\local.magento:8580

@alexcheng1982
Copy link
Owner

Added more doc about development and testing using this Docker image.

@taqvi
Copy link

taqvi commented Nov 3, 2020

@alexcheng1982 can you share how to configure this image for Xdebug with phpstrom please, its much needed thing!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants