From e347b1793aa0118996376ed733a7cab6846fb78c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 21 Nov 2024 08:36:58 +0100 Subject: [PATCH] feat: add support for defining localtime via volume Docker engine follows symlinks when creating the volume what makes /tmp/localtime read-only. But user has apparently configured timezone in this case so we can skip this step. --- .github/workflows/dockerimage.yml | 88 +++++++++++++++++++++++++++++++ docker-compose | 2 +- start | 12 +++-- 3 files changed, 96 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index ccc28270f..397fdac16 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -270,6 +270,94 @@ jobs: cd docker-compose ./test-stop + test-localtime: + runs-on: ubuntu-24.04 + name: Test localtime, stable + needs: + - build + - test-basic + env: + MATRIX_ARCHITECTURE: linux/amd64 + COMPOSE_PROJECT_NAME: wl + PYTHONUNBUFFERED: 1 + TEST_CONTAINER: weblate/weblate:test + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Expose GitHub Runtime + uses: crazy-max/ghaction-github-runtime@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.7.1 + with: + # renovate: datasource=github-releases depName=docker/buildx + version: v0.18.0 + - name: Build the Docker image + run: .github/bin/docker-build load + - name: List Docker images + run: docker image ls --all + - name: Generate configuration + run: | + cd docker-compose + ./test-generate 8080 http localtime + - name: Startup container + run: | + cd docker-compose + ./test-boot + - name: List Python packages + run: | + cd docker-compose + ./test-pip + - name: Inspect container + run: | + cd docker-compose + ./test-inspect + - name: Check service is running + run: | + cd docker-compose + ./test-online + - name: Check service health status + run: | + cd docker-compose + ./test-health + - name: Run Django Checks + run: | + cd docker-compose + ./test-checks + - name: Verify supervisor + run: | + cd docker-compose + ./test-supervisor + - name: Test admin creation + run: | + cd docker-compose + ./test-admin + - name: Test commands + run: | + cd docker-compose + ./test-commands + - name: Display logs + if: always() + run: | + cd docker-compose + ./test-logs + - name: Stop Weblate service + run: | + cd docker-compose + docker compose stop weblate + - name: Start Weblate service + run: | + cd docker-compose + docker compose start weblate + - name: Check service is running + run: | + cd docker-compose + ./test-online + - name: Shutdown service + run: | + cd docker-compose + ./test-stop + test-saml: runs-on: ubuntu-24.04 name: Test SAML, stable diff --git a/docker-compose b/docker-compose index 1a6c22d8f..62f69c249 160000 --- a/docker-compose +++ b/docker-compose @@ -1 +1 @@ -Subproject commit 1a6c22d8fb7319bfe9cfaf62d9c24adba7e4dc55 +Subproject commit 62f69c24926097a0a5975f74cd4139a2af0222fb diff --git a/start b/start index 8bb11979e..77076f6fa 100755 --- a/start +++ b/start @@ -104,11 +104,13 @@ export PGPASSWORD="$POSTGRES_PASSWORD" export PGSSLMODE="$POSTGRES_SSL_MODE" # Update the time zone -zonefile="/usr/share/zoneinfo/$WEBLATE_TIME_ZONE" -if [ -n "$WEBLATE_TIME_ZONE" ] && [ -f "$zonefile" ] ; then - cat "$zonefile" > /tmp/localtime -else - cat /usr/share/zoneinfo/Etc/UTC > /tmp/localtime +if [ -w /tmp/localtime ] ; then + zonefile="/usr/share/zoneinfo/$WEBLATE_TIME_ZONE" + if [ -n "$WEBLATE_TIME_ZONE" ] && [ -f "$zonefile" ] ; then + cat "$zonefile" > /tmp/localtime + else + cat /usr/share/zoneinfo/Etc/UTC > /tmp/localtime + fi fi # Create fake Python app for customization