Skip to content

Commit f477a6a

Browse files
added docker file and build script to auto-install plugin on docker image build
1 parent 0b1d7e5 commit f477a6a

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker/bin

docker/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ARG DRUPAL_IMAGE_VERSION
2+
3+
FROM drupal:${DRUPAL_IMAGE_VERSION}
4+
5+
COPY --chown=www-data:www-data ./bin/tawkto /opt/drupal/web/modules/tawkto

docker/build.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
set -e;
3+
4+
build_dir=$(dirname $0);
5+
module_dir=$build_dir/bin/tawkto;
6+
7+
if [ -d "$module_dir" ]; then
8+
echo "Removing existing module folder";
9+
rm -r $module_dir;
10+
fi
11+
12+
echo "Creating module folder";
13+
mkdir -p $module_dir;
14+
15+
echo "Copying files to module folder";
16+
cp -r $build_dir/../tawk_to/* $module_dir
17+
18+
echo "Done building module folder";
19+
20+
echo "Building docker image"
21+
if [ -z $1 ]; then
22+
docker-compose build;
23+
else
24+
docker-compose --env-file $1 build;
25+
fi

docker/docker-compose.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ services:
1212
MYSQL_PASSWORD: drupal
1313

1414
drupal:
15+
build:
16+
context: .
17+
args:
18+
DRUPAL_IMAGE_VERSION: ${DRUPAL_IMAGE_VERSION}
1519
depends_on:
1620
- db
17-
image: drupal:${DRUPAL_IMAGE_VERSION}
1821
ports:
1922
- 8000:80
2023
volumes:
21-
- web_data:/var/www/html
24+
- web_data:/opt/drupal
2225
volumes:
2326
db_data:
2427
web_data:

0 commit comments

Comments
 (0)