Skip to content

Commit

Permalink
Support custom webroot
Browse files Browse the repository at this point in the history
  • Loading branch information
tuutti committed Dec 11, 2024
1 parent b1fb140 commit 05a5839
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
18 changes: 14 additions & 4 deletions openshift/drupal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ARG ALPINE_VERSION=3.20
FROM alpine:${ALPINE_VERSION} AS php

# Install required tools (https://docs.acquia.com/blt/install/)
# alpine-sdk required for the make script in composer.json
RUN set -eux; \
apk update && apk upgrade && \
apk add --no-cache git \
Expand All @@ -14,7 +13,13 @@ RUN set -eux; \
rsync \
bash \
mariadb-client \
alpine-sdk \
# This is required by MySQL 8 (caching_sha2_password plugin)
mariadb-connector-c \
grep \
make \
git \
tar \
openssl \
nginx \
bash \
jq \
Expand All @@ -25,8 +30,8 @@ RUN \
echo 'export PS1="[${APP_ENV:-env}] \[\e[1;31m\][${HOSTNAME:-hostname}] \[\e[1;33m\]\w\[\e[0m\] $ "' | tee /etc/profile /etc/bash/ps1.sh
ENV ENV="/etc/profile"

# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/
COPY --from=amazeeio/envplate:v1.0.3 /usr/local/bin/ep /usr/local/bin/ep

ENV PATH=${PATH}:/app/vendor/bin:/var/www/html/vendor/bin
ENV COMPOSER_HOME=/.composer
Expand Down Expand Up @@ -63,7 +68,8 @@ RUN \
# Correct permissions to nginx folders.
chmod -R a+rwx /var/lib/nginx && \
chmod -R a+rwx /var/log/nginx && \
chmod -R a+rwx /etc/nginx/conf.d
chmod -R a+rwx /etc/nginx/conf.d && \
chmod -R a+rwx /etc/nginx/http.d

ENTRYPOINT ["/sbin/tini", "--"]

Expand Down Expand Up @@ -91,9 +97,11 @@ RUN set -eux; \
php83-xmlreader \
php83-xmlwriter \
php83-simplexml \
php83-sockets \
php83-ctype \
php83-gd \
php83-sodium \
php83-bcmath \
php83-pecl-apcu \
php83-pecl-redis; \
apk --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community --repository=https://dl-cdn.alpinelinux.org/alpine/edge/main add \
Expand All @@ -114,6 +122,7 @@ RUN set -eux; \
php84-openssl \
php84-phar \
php84-session \
php84-sockets \
php84-zip \
php84-dom \
php84-pdo \
Expand All @@ -125,6 +134,7 @@ RUN set -eux; \
php84-ctype \
php84-gd \
php84-sodium \
php84-bcmath \
php84-pecl-apcu \
php84-pecl-redis \
php84-pecl-imagick; \
Expand Down
2 changes: 1 addition & 1 deletion openshift/drupal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ define run_tests
endef

define build_image
docker buildx bake $(BUILD_EXTRA_ARGS) --pull --push -f docker-bake.hcl $(1)
docker buildx bake $(BUILD_EXTRA_ARGS) --no-cache --pull --push -f docker-bake.hcl $(1)
endef

.PHONY: $(PHONY)
12 changes: 0 additions & 12 deletions openshift/drupal/files/entrypoints/15-syslog.sh

This file was deleted.

7 changes: 7 additions & 0 deletions openshift/drupal/files/entrypoints/20-prepare-nginx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

if echo "$APP_ENV" | grep -Eq '(local|dev|development|test|testing|stage|staging)'; then
echo 'add_header X-Robots-Tag "noindex, nofollow";' >> /etc/nginx/conf.d/global-headers
fi

ep /etc/nginx/http.d/default.conf
5 changes: 0 additions & 5 deletions openshift/drupal/files/entrypoints/99-nginx.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#!/bin/sh

if echo "$APP_ENV" | grep -Eq '(local|dev|development|test|testing|stage|staging)'; then
echo 'add_header X-Robots-Tag "noindex, nofollow";' >> /etc/nginx/conf.d/global-headers
fi

echo "Start up Nginx..."

nginx -g 'daemon off;'
2 changes: 1 addition & 1 deletion openshift/drupal/files/etc/nginx/http.d/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server {
listen 8080 default_server;
server_name _;

root /var/www/html/public;
root ${WEBROOT:-/var/www/html/public};
index index.php;

# Support for the helfi_proxy module
Expand Down

0 comments on commit 05a5839

Please sign in to comment.