From 6376f5855854170e678f5b80ec560705aff07865 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz>
Date: Tue, 25 Oct 2022 21:49:47 +0200
Subject: [PATCH] Cron v2

---
 .gitlab-ci.yml |  2 +-
 Dockerfile     |  3 ++-
 run.sh         | 18 ++++++++++++++++++
 3 files changed, 21 insertions(+), 2 deletions(-)
 create mode 100755 run.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8a0aa20..4e0e873 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,7 @@ image: docker:20.10.9
 
 variables:
   DOCKER_TLS_CERTDIR: "/certs"
-  BUILD_VERSION: p8
+  BUILD_VERSION: p9
 
 services:
   - docker:20.10.9-dind
diff --git a/Dockerfile b/Dockerfile
index d285ff2..1e4d679 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,7 +4,8 @@ MAINTAINER Andrej Ramašeuski <andrej.ramaseuski@pirati.cz>
 USER 0
 RUN install_packages cron
 COPY crontab /etc/cron.d/
+COPY run.sh /opt/bitnami/scripts/apache/
 USER 1001
 
 COPY phpbb /opt/bitnami/phpbb
-CMD [  ( cron -f -l 8 & ) & "/opt/bitnami/scripts/apache/run.sh" ]
+CMD [ "/opt/bitnami/scripts/apache/run.sh" ]
diff --git a/run.sh b/run.sh
new file mode 100755
index 0000000..06f45ac
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# shellcheck disable=SC1091
+
+set -o errexit
+set -o nounset
+set -o pipefail
+# set -o xtrace # Uncomment this line for debugging purpose
+
+# Load libraries
+. /opt/bitnami/scripts/libapache.sh
+. /opt/bitnami/scripts/liblog.sh
+
+# Load Apache environment
+. /opt/bitnami/scripts/apache-env.sh
+
+info "** Starting Apache **"
+exec cron -l -f && "${APACHE_BIN_DIR}/httpd" -f "$APACHE_CONF_FILE" -D "FOREGROUND"
-- 
GitLab