Skip to content

Commit b2532ae

Browse files
committed
feat(docker): improve runtime environment and fix git ownership error
This commit introduces several improvements to the Docker environment, primarily resolving the `fatal: detected dubious ownership` error that occurred when running commands on mounted volumes.
1 parent 56b0725 commit b2532ae

7 files changed

Lines changed: 399 additions & 203 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.env.local
44
.env.*.local
55
!.env.example
6+
!.env.dev
67

78
# Application
89
app/vendor/

Dockerfile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ SHELL ["/bin/ash", "-o", "pipefail", "-c"]
3838

3939
# Propagate build args to this stage
4040
ARG PHP_VERSION
41+
ARG PHP_OPCACHE_VALIDATE_TIMESTAMPS
42+
ARG PHP_OPCACHE_MAX_ACCELERATED_FILES
43+
ARG PHP_OPCACHE_ENABLE
44+
ARG PHP_OPCACHE_MEMORY_CONSUMPTION
4145
ARG NGINX_VERSION
4246
ARG REDIS_VERSION
4347
ARG ALPINE_VERSION
@@ -67,10 +71,10 @@ LABEL maintainer="KaririCode <community@kariricode.org>" \
6771
ENV COMPOSER_ALLOW_SUPERUSER=1 \
6872
COMPOSER_HOME=/composer \
6973
PATH="/composer/vendor/bin:/symfony/bin:/usr/local/bin:/usr/sbin:/sbin:$PATH" \
70-
PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 \
71-
PHP_OPCACHE_MAX_ACCELERATED_FILES=20000 \
72-
PHP_OPCACHE_MEMORY_CONSUMPTION=256 \
73-
PHP_OPCACHE_ENABLE=1 \
74+
PHP_OPCACHE_VALIDATE_TIMESTAMPS=${PHP_OPCACHE_VALIDATE_TIMESTAMPS} \
75+
PHP_OPCACHE_MAX_ACCELERATED_FILES=${PHP_OPCACHE_MAX_ACCELERATED_FILES} \
76+
PHP_OPCACHE_MEMORY_CONSUMPTION=${PHP_OPCACHE_MEMORY_CONSUMPTION} \
77+
PHP_OPCACHE_ENABLE=${PHP_OPCACHE_ENABLE} \
7478
STACK_VERSION=${VERSION}
7579

7680
# ------------------------------------------------------------
@@ -83,10 +87,12 @@ RUN set -eux; \
8387
# network / TLS
8488
apk add --no-cache git curl wget ca-certificates openssl; \
8589
# misc runtime libs
86-
apk add --no-cache gettext tzdata pcre2 zlib; \
90+
apk add --no-cache gettext tzdata pcre2 zlib unzip; \
8791
# image/zip/xml/icu
8892
apk add --no-cache icu-libs libzip libpng libjpeg-turbo freetype libxml2; \
89-
update-ca-certificates
93+
update-ca-certificates \
94+
\
95+
git config --global --add safe.directory /var/www/html
9096

9197
# ------------------------------------------------------------
9298
# Users & directories (least privilege)
@@ -138,6 +144,7 @@ RUN set -eux; \
138144
# Intentional word splitting for extension list
139145
# shellcheck disable=SC2086
140146
docker-php-ext-install -j"$(nproc)" ${PHP_CORE_EXTENSIONS}; \
147+
apk del .build-deps; \
141148
php -m | sed 's/^/ -> /'
142149

143150
# ------------------------------------------------------------

0 commit comments

Comments
 (0)