Skip to content

Commit 37fc1a7

Browse files
authored
Merge pull request #67 from City-of-Helsinki/UHF-13003
UHF-13003: Env variable to detect if we're running the command inside a container
2 parents 51371cc + 655b7b2 commit 37fc1a7

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

drupal/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ RUN chmod +x /entrypoints/* && \
4343
ENV PATH=${PATH}:/app/vendor/bin:/var/www/html/vendor/bin
4444
ENV COMPOSER_HOME=/.composer
4545
ENV ENV="/etc/profile"
46+
# We use this to detect if we're running the command inside
47+
# a container.
48+
ENV CONTAINER_RUNNING=true
4649

4750
RUN \
4851
# Create private files folder

drupal/tests/tests/Shared/EnvVariableTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public function testEnvVariable(string $envVariable, string $expectedValue) : vo
1515

1616
public static function envVariableData() : array {
1717
return [
18+
['CONTAINER_RUNNING', 'true'],
1819
['PATH', '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/app/vendor/bin:/var/www/html/vendor/bin'],
1920
['AZURE_SQL_SSL_CA_PATH', '/etc/ssl/certs/ca-certificates.crt'],
2021
];

0 commit comments

Comments
 (0)