Skip to content
This repository was archived by the owner on Nov 8, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMPOSE_PROJECT_NAME=sylius
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
docker-compose.local.yml
src/*
47 changes: 22 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,35 @@
FROM sylius/nginx-php-fpm:latest
FROM php:7.2-fpm-alpine3.8
MAINTAINER Sylius Docker Team <docker@sylius.org>

ARG AS_UID=33

ENV SYLIUS_VERSION 1.1.1
ENV SYLIUS_VERSION 1.3.2

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
RUN apk --no-cache upgrade && \
apk --no-cache add curl icu-dev libpng-dev

RUN docker-php-ext-install intl exif gd fileinfo pdo_mysql opcache > /dev/null 2>&1

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer && \
chmod +x /usr/bin/composer

RUN chown www-data:www-data -R ${BASE_DIR};

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

# entrypoint.d scripts
COPY entrypoint.d/* /entrypoint.d/
COPY sylius/sylius-fpm.ini /usr/local/etc/php/conf.d/sylius.ini

RUN composer global require hirak/prestissimo && \
composer create-project sylius/sylius-standard ${SYLIUS_DIR} ${SYLIUS_VERSION}

# nginx configuration
COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/sylius_params /etc/nginx/sylius_params
COPY sylius/.env ${SYLIUS_DIR}/.env

RUN chown www-data.www-data /etc/nginx/sylius_params
RUN chmod +x sylius/bin/console && \
mkdir -p ${SYLIUS_DIR}/public/media/image

# entrypoint.d scripts
COPY entrypoint.d/* /entrypoint.d/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Because ``docker-compose.yml`` uses Compose file format 2.1 at least **Docker ve

```
git clone https://github.com/sylius/docker sylius-docker
cd sylius-docker
make help
make up
make console CMD=sylius:install
Expand Down
26 changes: 16 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
version: '2.1'
version: '3.1'

services:
sylius:
container_name: ${NAME}-app
nginx:
image: nginx:1-alpine
depends_on:
- php-fpm
ports:
- 8000:80
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/sylius_params:/etc/nginx/sylius_params
- ./src:/var/www/sylius

php-fpm:
build:
context: .
args:
- AS_UID=${AS_UID:-33}
context: .
environment:
- SYLIUS_DATABASE_HOST=mysql
- SYLIUS_DATABASE_USER=sylius
- SYLIUS_DATABASE_PASSWORD=sylius
- SYLIUS_MAILER_HOST=mailhog:1025
- SYLIUS_APP_DEV_PERMITTED=1
ports:
- 8000:80
volumes:
- ./src:/var/www/sylius

mysql:
container_name: ${NAME}-mysql
image: percona:5.7
environment:
MYSQL_ROOT_PASSWORD: sylius
Expand All @@ -28,7 +35,6 @@ services:
- 127.0.0.1:3606:3306

mailhog:
container_name: ${NAME}-mailhog
image: mailhog/mailhog:latest
ports:
- 8025:8025
11 changes: 5 additions & 6 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
user www-data;
worker_processes auto;
worker_rlimit_nofile 2048;

Expand All @@ -11,7 +10,7 @@ events {

http {
upstream sylius {
server sylius:9000;
server php-fpm:9000;
}

include /etc/nginx/mime.types;
Expand All @@ -36,23 +35,23 @@ http {

# General virtual host settings
server_name _;
root /var/www/sylius/web/;
index app_dev.php;
root /var/www/sylius/public/;
index index.php;
charset utf-8;

# Don't send the nginx version number in error pages and Server header
server_tokens off;

# Root directory location handler
location / {
try_files $uri $uri/ /app_dev.php?$query_string;
try_files $uri $uri/ /index.php?$query_string;
}

# php-fpm configuration
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass sylius;
fastcgi_index app_dev.php;
fastcgi_index index.php;

include fastcgi_params;

Expand Down
23 changes: 23 additions & 0 deletions sylius/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file
# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production.
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_DEBUG=1
APP_SECRET=EDITME
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls
DATABASE_URL=mysql://sylius:sylius@mysql/sylius_%kernel.environment%
###< doctrine/doctrine-bundle ###

###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# Delivery is disabled by default via "null://localhost"
MAILER_URL=smtp://localhost
###< symfony/swiftmailer-bundle ###
2 changes: 0 additions & 2 deletions sylius/.gitignore

This file was deleted.

9 changes: 9 additions & 0 deletions sylius/sylius-fpm.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
memory_limit = 2560M

error_reporting = E_ALL
error_log = /var/log/php/php_errors.log
log_errors = on

date.timezone = Europe/Zurich
date.default_latitude = 47.3676407
date.default_longitude = 8.5620881