From 42fc180c25714eb7e719f4fc61486eba866ea10a Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 31 Dec 2023 14:45:39 +0000 Subject: [PATCH] [docker] set BUILD_TIME/BUILD_HASH vars --- .github/workflows/publish.yml | 8 +++++++- Dockerfile | 3 ++- core/basepage.php | 2 +- core/send_event.php | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2e8fd122..d3ce57c3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,12 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' || github.event_name == 'push' }} steps: - - uses: actions/checkout@master + - name: Checkout + uses: actions/checkout@master + - name: Set build vars + run: | + echo "BUILD_TIME=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV + echo "BUILD_HASH=$GITHUB_SHA" >> $GITHUB_ENV - name: Publish to Registry uses: elgohr/Publish-Docker-Github-Action@main with: @@ -25,4 +30,5 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} cache: ${{ github.event_name != 'schedule' }} buildoptions: "--build-arg RUN_TESTS=false" + buildargs: BUILD_TIME,BUILD_HASH tag_semver: true diff --git a/Dockerfile b/Dockerfile index 0f797161..d8c80109 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,7 +53,8 @@ EXPOSE 8000 FROM base AS run EXPOSE 8000 # HEALTHCHECK --interval=1m --timeout=3s CMD curl --fail http://127.0.0.1:8000/ || exit 1 -ENV UID=1000 GID=1000 UPLOAD_MAX_FILESIZE=50M +ARG BUILD_TIME=unknown BUILD_HASH=unknown +ENV UID=1000 GID=1000 UPLOAD_MAX_FILESIZE=50M BUILD_TIME=${BUILD_TIME} BUILD_HASH=${BUILD_HASH} COPY --from=build /app /app WORKDIR /app ENTRYPOINT ["/app/.docker/entrypoint.sh"] diff --git a/core/basepage.php b/core/basepage.php index b4dc0474..18617e69 100644 --- a/core/basepage.php +++ b/core/basepage.php @@ -527,7 +527,7 @@ class BasePage print << - + $head_html $body_html diff --git a/core/send_event.php b/core/send_event.php index e8ee335c..f96a3da0 100644 --- a/core/send_event.php +++ b/core/send_event.php @@ -21,7 +21,9 @@ function _load_event_listeners(): void { global $_shm_event_listeners; - $cache_path = data_path("cache/shm_event_listeners.php"); + $key = md5(Extension::get_enabled_extensions_as_string()); + + $cache_path = data_path("cache/shm_event_listeners.$key.php"); if (SPEED_HAX && file_exists($cache_path)) { require_once($cache_path); } else {