Skip to content

Commit

Permalink
feat(shopware): add nginx to container for aws environment
Browse files Browse the repository at this point in the history
  • Loading branch information
joerivanveen committed Oct 24, 2024
1 parent 5876d3b commit a9e679e
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 96 deletions.
4 changes: 0 additions & 4 deletions images/shopware-nginx/Dockerfile

This file was deleted.

5 changes: 5 additions & 0 deletions images/shopware/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ COMPOSE_PROFILES=
API_KEY_MYPARCELNL=
API_KEY_MYPARCELBE=

###
# Set to 0 if you have a separate nginx container in your setup, to 1 to include nginx in this container.
###
WITH_NGINX=0

# Fill in these variables to be able to use the blackfire service. You can find
# these keys at https://blackfire.io/my/settings/credentials
BLACKFIRE_CLIENT_ID=
Expand Down
16 changes: 14 additions & 2 deletions images/shopware/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ WORKDIR ${ROOT_DIR}
RUN apk upgrade && \
# Add dependencies
apk add --no-cache \
# To run in AWS \
nginx \
# ext-gd
freetype-dev \
libjpeg-turbo-dev \
Expand All @@ -35,7 +37,17 @@ RUN apk upgrade && \
# For building assets
"nodejs>${NODE_VERSION}" \
npm \
"$PHPIZE_DEPS" \
# $PHPIZE_DEPS:
autoconf \
dpkg-dev \
dpkg \
file \
g++ \
gcc \
libc-dev \
make \
pkgconf \
re2c \
&& \
docker-php-ext-configure gd \
--with-jpeg \
Expand Down Expand Up @@ -107,10 +119,10 @@ RUN apk add --no-cache \
zsh

COPY ./config/.psh.yaml.override.template /tmp/.psh.yaml.override.template
COPY ./config/nginx /etc/nginx
COPY ./config/php /usr/local/etc/php
COPY ./config/root .
COPY ./scripts /tmp/scripts
COPY ./etc/nginx/http.d /etc/nginx/http.d

ENV YARN_VERSION=${YARN_VERSION}
ENV SW_VERSION=${SW_VERSION}
Expand Down
72 changes: 0 additions & 72 deletions images/shopware/config/nginx/templates/default.conf.template

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@

server {
set $site_url "${BASE_URL}";
set $root_dir "${PROJECT_ROOT}";
root /var/www/html;

listen 80;

# Handle / to index.php
index index.php;

# Our server name
server_name $server_name;

# Where the code is located
root $root_dir/public;

# Redirect to https
add_header Content-Security-Policy upgrade-insecure-requests;

# Needed for Shopware install / update
location /recovery/install {
index index.php;
Expand Down Expand Up @@ -58,7 +45,7 @@ server {

# Let php-fpm handle .php files
location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_pass localhost:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
fastcgi_param HTTP_PROXY "";
Expand Down
Empty file modified images/shopware/scripts/_add-preset-data.sh
100644 → 100755
Empty file.
Empty file modified images/shopware/scripts/_build.sh
100644 → 100755
Empty file.
Empty file modified images/shopware/scripts/_cache.sh
100644 → 100755
Empty file.
4 changes: 1 addition & 3 deletions images/shopware/scripts/_helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ link-paths() {

# Ignore if path is not a directory.
[ -d "${path}" ] || continue
# Overwrite existing symlinks.
unlink "$dest_path" 2> /dev/null

h2 "Linking $path => $dest_path"
ln -sf "$path" "$dest_path"
ln -snf "$path" "$dest_path"
done
else
h2 "No folders found in $source_dir"
Expand Down
19 changes: 19 additions & 0 deletions images/shopware/scripts/_start-nginx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

start-nginx() {
h1 "Starting nginx..."

if pidof -s nginx > /dev/null; then
h2 "nginx is already running"
return
fi

nginx;

if [ "$?" -eq 0 ]; then
h2 "Started nginx."
else
h2 "Failed to start nginx."
exit 1
fi
}
Empty file modified images/shopware/scripts/_wait-for-deps.sh
100644 → 100755
Empty file.
4 changes: 4 additions & 0 deletions images/shopware/scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@ fi

reset-permissions

if [ "${WITH_NGINX}" -eq 1 ]; then
start-nginx
fi

h1 "🔵 Shopware is ready at ${FULL_URL}/admin ✨"
tail -f var/log/*.log & wait

0 comments on commit a9e679e

Please sign in to comment.