Skip to content

Commit

Permalink
Refactor, use for each folder own container
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Dec 13, 2019
1 parent 786f9db commit d7e302b
Show file tree
Hide file tree
Showing 44 changed files with 320 additions and 564 deletions.
5 changes: 4 additions & 1 deletion .env.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Copy me to $HOME/.swdc_env to modify configuration

# Use ssl as default
USE_SSL_DEFAULT=false

# Persistent Database?
PERSISTENT_DATABASE=true

Expand All @@ -19,7 +22,7 @@ ENABLE_REDIS=false
# S3 compatible Server
ENABLE_MINIO=false

# Possible values are 5.6, 7.0, 7.1, 7.2, 7.3, 7.4
# Possible values are 7.1, 7.2, 7.3, 7.4
PHP_VERSION=7.2

# Possible values are 5.5, 5.6, 5.7, 8
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
/images/node_modules
/docker-compose.override.yaml
/package-lock.json
/.env
/.env
/nginx/rootfs/etc/nginx/sites-enabled/www.conf
17 changes: 15 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,23 @@ steps:
- task: Docker@2
condition: eq(variables['MODULE'], 'nginx')
displayName: 'Push Nginx Images'
displayName: 'Push Nginx Shopware 6 Images'
inputs:
containerRegistry: 'Docker Hub'
repository: 'shyim/shopware-nginx'
repository: 'shopware-platform-nginx'
command: 'push'
tags: |
php71
php72
php73
php74
- task: Docker@2
condition: eq(variables['MODULE'], 'nginx')
displayName: 'Push Nginx Shopware 5 Images'
inputs:
containerRegistry: 'Docker Hub'
repository: 'shopware-classic-nginx'
command: 'push'
tags: |
php71
Expand Down
26 changes: 0 additions & 26 deletions docker-compose.yml

This file was deleted.

45 changes: 45 additions & 0 deletions functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,48 @@ function trim_whitespace() {
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
echo -n "$var"
}

function get_image()
{
folder=$1
var="VHOST_${folder^^}_IMAGE"
var="${var//-/_}"
val=${!var}

if [[ ! -z $val ]]; then
echo $val
else
IMAGE="shyim/shopware-classic-nginx"
if [[ -f "$2/public/index.php" ]]; then
IMAGE="shyim/shopware-platform-nginx"
fi

echo "${IMAGE}:php${PHP_VERSION}"
fi
}

function get_hosts()
{
folder=$1
var="VHOST_${folder^^}_HOSTS"
var="${var//-/_}"
val=${!var}

if [[ ! -z $val ]]; then
echo $val
else
echo "${folder}.dev.localhost"
fi
}

function get_url()
{
hosts=$(get_hosts $1)
host=$(cut -d ',' -f 1 <<< "${hosts}")

if [[ $USE_SSL_DEFAULT == "true" ]]; then
echo "https://${host}"
else
echo "http://${host}"
fi
}
12 changes: 10 additions & 2 deletions images/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@ for t in ${phpVersions[@]}; do

if [[ $1 == "nginx" || $1 == "all" ]]; then
echo "Building nginx container for $t"
docker build -t shyim/shopware-nginx:${t} -f ./nginx/${t}/Dockerfile ./nginx/
cp nginx/10-classic.conf nginx/rootfs/etc/nginx/sites-enabled/www.conf
docker build -t shyim/shopware-classic-nginx:${t} -f ./nginx/${t}/Dockerfile ./nginx/

cp nginx/10-platform.conf nginx/rootfs/etc/nginx/sites-enabled/www.conf
docker build -t shyim/shopware-platform-nginx:${t} -f ./nginx/${t}/Dockerfile ./nginx/
fi

if [[ $1 == "xdebug" || $1 == "all" ]]; then
if [[ -d "./nginx/${t}-xdebug" ]]; then
docker build -t shyim/shopware-nginx:${t}-xdebug -f ./nginx/${t}-xdebug/Dockerfile ./nginx/
cp nginx/10-classic.conf nginx/rootfs/etc/nginx/sites-enabled/www.conf
docker build -t shyim/shopware-classic-nginx:${t}-xdebug -f ./nginx/${t}-xdebug/Dockerfile ./nginx/

cp nginx/10-platform.conf nginx/rootfs/etc/nginx/sites-enabled/www.conf
docker build -t shyim/shopware-platform-nginx:${t}-xdebug -f ./nginx/${t}-xdebug/Dockerfile ./nginx/
fi
fi

Expand Down
12 changes: 12 additions & 0 deletions images/nginx/10-classic.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
server {
listen 80;

server_name localhost;
root /var/www/html/;

set $shopware_env 'docker';
set $fpm_upstream 127.0.0.1:9000;

## Include shopware configuration.
include global/shopware.conf;
}
37 changes: 37 additions & 0 deletions images/nginx/10-platform.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
server {
listen 80;

index index.php index.html;
server_name localhost;
root /var/www/html/public;

# Shopware install / update
location /recovery/install {
index index.php;
try_files $uri /recovery/install/index.php$is_args$args;
}

location /recovery/update/ {
location /recovery/update/assets {
}
if (!-e $request_filename){
rewrite . /recovery/update/index.php last;
}
}

location / {
try_files $uri /index.php$is_args$args;
}

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
fastcgi_param HTTP_PROXY "";
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
client_max_body_size 24M;
client_body_buffer_size 128k;
fastcgi_pass 127.0.0.1:9000;
http2_push_preload on;
}
}
3 changes: 0 additions & 3 deletions images/nginx/Dockerfile.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM php:{{ phpVersion }}-fpm-alpine

ENV SHOPWARE_ENV docker

COPY --from=ochinchina/supervisord:latest /usr/local/bin/supervisord /usr/bin/supervisord

RUN set -x && \
Expand Down Expand Up @@ -118,5 +116,4 @@ ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
COPY rootfs/ /
EXPOSE 80

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
37 changes: 0 additions & 37 deletions images/nginx/rootfs/docker-entrypoint.sh

This file was deleted.

16 changes: 0 additions & 16 deletions images/nginx/rootfs/etc/nginx/proxy.tpl

This file was deleted.

79 changes: 0 additions & 79 deletions images/nginx/rootfs/etc/nginx/sites-enabled/10-platform.conf

This file was deleted.

29 changes: 0 additions & 29 deletions images/nginx/rootfs/etc/nginx/sites-enabled/10-sw5.conf

This file was deleted.

Loading

0 comments on commit d7e302b

Please sign in to comment.