Skip to content

Commit 4fc6fc0

Browse files
Add entrypoint.sh script to start Apache and cron and make Dockerfile run it after building
1 parent ba0070c commit 4fc6fc0

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,9 @@ RUN rm -f index.html \
5454
&& chmod 777 filestore \
5555
&& chmod -R 777 include/
5656

57-
CMD apachectl -D FOREGROUND
57+
# Copy custom entrypoint script
58+
COPY entrypoint.sh /entrypoint.sh
59+
RUN chmod +x /entrypoint.sh
60+
61+
# Start both cron and Apache
62+
CMD ["/entrypoint.sh"]

entrypoint.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# Start cron service
4+
service cron start
5+
6+
# Ensure daily cron jobs are executable
7+
chmod +x /etc/cron.daily/*
8+
9+
# Start Apache in the foreground (keeps the container alive)
10+
apachectl -D FOREGROUND

0 commit comments

Comments
 (0)