Skip to content

Commit f637520

Browse files
committed
Move drupal folder when docker run.
1 parent 25a586e commit f637520

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ RUN \
122122

123123
### Add drupal 10 related drush
124124
RUN \
125-
cd /var/www/html && \
125+
cd /tmp/drupal-* && \
126126
composer update && \
127127
composer update "drupal/core-*" --with-all-dependencies && \
128128
composer require drush/drush --with-all-dependencies

image/drupal-download.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,4 @@ if [ -d /tmp/drupal-${LATEST_VERSION} ]; then
1212
fi
1313
echo "Downloading Drupal $LATEST_VERSION ..."
1414
curl -s "https://ftp.drupal.org/files/projects/drupal-${LATEST_VERSION}.tar.gz" | tar -xz -C /tmp
15-
if [ ! -d /var/www/html ]; then
16-
mkdir -p /var/www/html
17-
fi
18-
mv /tmp/drupal-$LATEST_VERSION/* /tmp/drupal-$LATEST_VERSION/.[!.]* /var/www/html/
19-
rm -Rf /tmp/drupal-$LATEST_VERSION
20-
echo "Drupal $LATEST_VERSION downloaded on /var/www/html"
15+
echo "Drupal $LATEST_VERSION downloaded to /tmp/drupal-${LATEST_VERSION}"

image/start.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
#!/bin/bash
22

3+
# Check if /var/www/html is empty
4+
if [ -z "$(ls -A /var/www/html)" ]; then
5+
echo "Directory /var/www/html is empty, copying Drupal files..."
6+
# Find the drupal directory under /tmp
7+
DRUPAL_DIR=$(find /tmp -maxdepth 1 -type d -name "drupal-*" | sort -V | tail -n 1)
8+
if [ -n "$DRUPAL_DIR" ]; then
9+
echo "Found Drupal directory: $DRUPAL_DIR"
10+
cp -r $DRUPAL_DIR/* $DRUPAL_DIR/.[!.]* /var/www/html/
11+
chown -R www-data:www-data /var/www/html
12+
echo "Drupal files copied successfully"
13+
else
14+
echo "Error: Drupal directory not found in /tmp"
15+
exit 1
16+
fi
17+
fi
18+
319
# Ensure the directory exists
420
mkdir -p /var/www/html/log/supervisor
521

0 commit comments

Comments
 (0)