Skip to content

Commit 0dabdc0

Browse files
committed
🐛 Fix Docker pip --user install error in virtualenv
Set VIRTUAL_ENV environment variable in Dockerfile to fix the error when building Android apps. The error was: ``` Can not perform a '--user' install. User site-packages are not visible in this virtualenv ``` The Docker container creates a virtualenv at /home/user/.venv but was only setting PATH, not VIRTUAL_ENV. This caused buildozer's virtualenv detection logic to incorrectly add --user flag to pip. Also restrict Docker image publishing to upstream repository only by adding repository_owner check to SHOULD_PUBLISH condition. This prevents forks from attempting to publish to container registries, which would fail due to missing credentials and GHCR's lowercase requirement for repository names. Fixes #1977
1 parent fc3c5d3 commit 0dabdc0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
env:
99
DOCKERHUB_IMAGE: kivy/buildozer
1010
GHCR_IMAGE: ghcr.io/${{ github.repository }}
11-
SHOULD_PUBLISH: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) }}
11+
SHOULD_PUBLISH: ${{ github.repository_owner == 'kivy' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) }}
1212

1313
jobs:
1414
build:

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ COPY . ${SRC_DIR}
7979
COPY --chmod=755 entrypoint.sh /usr/local/bin/entrypoint.sh
8080

8181
# installs buildozer and dependencies from a virtual environment
82-
ENV PATH="${HOME_DIR}/.venv/bin:${PATH}"
82+
ENV VIRTUAL_ENV="${HOME_DIR}/.venv"
83+
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
8384
RUN pip install --upgrade "Cython<3.0" wheel pip ${SRC_DIR}
8485

8586
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

0 commit comments

Comments
 (0)