Skip to content

Commit deceedf

Browse files
Fixup magento crons and catalog image process
1 parent e032c00 commit deceedf

File tree

6 files changed

+27
-16
lines changed

6 files changed

+27
-16
lines changed

Alpine.fragment.Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ STOPSIGNAL SIGHUP
5353
CMD ["/usr/local/bin/entrypoint"]
5454

5555
RUN <<FIXUP_BASH
56-
rm ~/.bashrc ~/.profile || true
57-
ln -s /etc/profile ~/.bashrc
58-
ln -s /etc/profile ~/.profile
56+
rm /root/.bashrc /root/.profile /home/app/.bashrc /home/app/.profile || true
57+
ln -s /etc/profile /root/.bashrc
58+
ln -s /etc/profile /root/.profile
59+
ln -s /etc/profile /home/app/.bashrc
60+
ln -s /etc/profile /home/app/.profile
5961
sed -i 's|/bin/ash|/bin/bash|' /etc/passwd
60-
FIXUP_BASH
61-
62+
FIXUP_BASH

fs/magento/etc/services.d/cron/run

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
source $(dirname "$0")/../common.sh
3+
(
4+
# wait until /etc/services.d/magento/done exists
5+
if [ ! -f /etc/services.d/magento/done ]; then
6+
echo "Waiting for Magento to be ready ..."
7+
while [ ! -f /etc/services.d/magento/done ]; do
8+
sleep 1
9+
done
10+
fi
11+
# Run once first to populate cron lists
12+
chpst -u app magento cron:run
13+
# Start running cron
14+
while true; do
15+
chpst -u app magento cron:run
16+
sleep 60
17+
done
18+
) 2>&1 | (while IFS= read -r; do echo "${COLOR_RESET}[${DIR}] $REPLY"; done)

fs/magento/etc/services.d/magento/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ function runStartupTasks() {
3333

3434
touch /etc/services.d/magento/starting
3535
fixCachePerms
36-
# if "magento" is executable
37-
if [ ! -x magento ]; then
36+
if [ $(which magento | wc -l) -eq 0 ]; then
37+
rm /etc/services.d/magento/starting
3838
echo "[$DIR] Error: '${COLOR_YELLOW}magento${COLOR_RESET}' utility binary is not detectable!"
3939
echo "[$DIR] You may need to add it to your ${COLOR_YELLOW}PATH${COLOR_RESET}."
4040
echo "[$DIR] PATH: ${COLOR_GREY}${PATH}${COLOR_RESET}"

fs/magento/etc/services.d/magento/tasks.d/010-magento-cron.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

fs/magento/etc/services.d/magento/tasks.d/080-magento-catalog-images.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ DIR="magento-images"
33
source $(dirname "$0")/common
44
(
55
echo "Generating Magento Catalog Images"
6-
magento catalog:image:resize --async --skip_hidden_images
6+
magento catalog:image:resize --async --quiet --skip_hidden_images
77
) 2>&1 | (while IFS= read -r; do echo "${COLOR_RESET}[${DIR}] $REPLY"; done)

fs/magento/etc/services.d/magento/tasks.d/common

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,3 @@ if [ "$(whoami)" != "app" ]; then
6464
exec su -s /bin/bash -c "$0" app
6565
exit 0
6666
fi
67-
echo "Running as $(whoami) in $(pwd)"

0 commit comments

Comments
 (0)