Giter Site home page Giter Site logo

docker-magento's Introduction

Magento v2 Docker Deployment

Instructions

Copy the .env.example to .env and edit it for the environment:

  • COMPOSE_PROJECT_NAME - The project name. This value will be appended to all of the container and volume names for the deployment.
  • COMPOSE_FILE - A colon-delimited list of yml files to be used for the deployment. For example, if this value were set to file1.yml:file2.yml, it will be like invoking docker-compose -f file1.yml -f file2.yml.
  • IMAGE_NS - The prefix for the image names
  • HTTPD_PORT_80 - The host port for the httpd container's port 80
  • HTTPD_PORT_443 - The host port for the httpd container's port 443
  • DB_PORT - The host and container port for the mysql container
  • SERVER_NAME - The website's servername
  • MAGENTO_VOLUME - Either an absolute path for a bind-mounted volume or the name of a docker volume
  • PHP_PORT - The host and container port that php-fpm will listen on
  • DEPLOY_USER - The user that the web app commands will run under
  • WORKDIR - The root directory of the web application

Copy the .yml.example to a .yml, edit it for the environment and then add it to the deployment by editing

The Services

httpd

This is the web server that the site will be running from. Just be sure to create a httpd/ssl/ssl-cert-snakeoil.pem file that contains the SSL private key followed by the cert data.

php

The magento site will be either bind-mounted to this container or deployed via script into a docker volume.

Add .ini files to the php/ini folder to have them copied to the php container.

mysql

The database container. You can create a mysql/conf.d/my.cnf file to change settings, such as running the DB on a different port:

[client]
port = 3309

[mysqld]
port = 3309

Deploying

Once everything is ready simply run

docker-compose up -d

Then go into the php container and run:

chmod +x bin/magento
bin/magento setup:install \
--base-url=https://magento.local \
--base-url-secure=https://magento.local \    
--db-host=magento_db:3309 \
--db-name=magento \
--db-user=magento \
--db-password=magento \
--backend-frontname=admin \
--admin-firstname=Spencer \
--admin-lastname=Williams \
[email protected] \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1 \
--use-secure=1 \
--use-secure-admin=1
start.sh

Replace the above arguments with values that are appropriate for the environment.

If a change is made to a a build context, you can rebuild the image with:

docker-compose build [service_name]

docker-magento's People

Contributors

enderandpeter avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.