diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5964f614..1418cbf5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,15 +50,6 @@ jobs: TIMESTAMP=$(date -u +'%Y%m%d%H%M%S') echo "timestamp=${TIMESTAMP}" >> $GITHUB_OUTPUT - # Update the timestamp in version.py - echo "Updating timestamp to ${TIMESTAMP} in version.py" - sed -i "s|__timestamp__ = None.*|__timestamp__ = '${TIMESTAMP}' # Set during CI/CD build process|" version.py - cat version.py # Verify the file was updated correctly - - # Make the version.py change part of the Docker build context - git add version.py - git commit -m "Update build timestamp [skip ci]" || echo "No changes to commit" - - name: Extract version info id: version run: | @@ -111,4 +102,5 @@ jobs: build-args: | BRANCH=${{ github.ref_name }} REPO_URL=https://github.com/${{ github.repository }} + TIMESTAMP=${{ steps.timestamp.outputs.timestamp }} file: ./docker/Dockerfile diff --git a/docker/Dockerfile b/docker/Dockerfile index e3f8a165..4d313e2c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,6 +5,8 @@ ARG BRANCH=main # This will be overridden by the GitHub Actions workflow # when building the Docker image for production. ARG REPO_URL=https://github.com/Dispatcharr/Dispatcharr +# Add timestamp argument +ARG TIMESTAMP ENV PATH="/dispatcharrpy/bin:$PATH" \ VIRTUAL_ENV=/dispatcharrpy \ @@ -26,8 +28,16 @@ RUN apt-get update && \ virtualenv /dispatcharrpy && \ git clone -b ${BRANCH} ${REPO_URL} /app && \ cd /app && \ - rm -rf .git && \ - cd /app && \ + rm -rf .git + +# Update version.py with build timestamp if provided +RUN if [ -n "$TIMESTAMP" ]; then \ + echo "Updating timestamp to ${TIMESTAMP} in version.py" && \ + sed -i "s|__timestamp__ = None.*|__timestamp__ = '${TIMESTAMP}' # Set during CI/CD build process|" /app/version.py && \ + cat /app/version.py; \ + fi + +RUN cd /app && \ pip install --no-cache-dir -r requirements.txt # Use a dedicated Node.js stage for frontend building