ci(docker): fix externally-managed-environment pip error on build

Per @geerlingguy post: https://www.jeffgeerling.com/blog/2023/how-solve-error-externally-managed-environment-when-installing-pip3

Signed-off-by: Andrei Jiroh Halili <ajhalili2006@gmail.com>
This commit is contained in:
Andrei Jiroh Halili 2023-09-25 09:32:30 +00:00
parent c98efaae59
commit a6198f6690
2 changed files with 12 additions and 17 deletions

View file

@ -84,7 +84,7 @@ jobs:
platforms: linux/amd64
#file: Dockerfile
# workaround: https://github.com/moby/buildkit/issues/2713#issuecomment-1068540101
push: false
push: true
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
@ -93,11 +93,6 @@ jobs:
type=registry,ref=quay.io/ajhalili2006/mkdocs-material-build-ci:branch-main
type=registry,ref=quay.io/ajhalili2006/mkdocs-material-build-ci:latest
#cache-to: type=registry,ref=quay.io/ajhalili2006/mkdocs-material-build-ci:buildkit-cache-web
- name: Workaround pushbot for misbehaving reverse proxies
if: ${{ github.event_name != 'pull_request' }}
run: |
set -x
echo "${{ steps.meta.outputs.tags }}" | xargs --verbose -I {} docker push {}
devenv:
name: Generate Gitpod workspace image snapshot
runs-on: ubuntu-latest
@ -162,7 +157,7 @@ jobs:
file: .gitpod.Dockerfile
platforms: linux/amd64
# workaround: https://github.com/moby/buildkit/issues/2713#issuecomment-1068540101
push: false
push: true
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
@ -171,8 +166,3 @@ jobs:
type=registry,ref=ghcr.io/ajhalili2006/ajhalili2006.github.io/devenv:nightly
type=registry,ref=ghcr.io/ajhalili2006/ajhalili2006.github.io/devenv:branch-main
#cache-to: type=registry,ref=quay.io/ajhalili2006/gitpod-workspace:buildkit-cache-web
- name: Workaround pushbot for misbehaving reverse proxies
if: ${{ github.event_name != 'pull_request' }}
run: |
set -x
echo "${{ steps.meta.outputs.tags }}" | xargs --verbose -I {} docker push {}

View file

@ -45,13 +45,18 @@ RUN apk add --no-cache \
| sh
# The "--break-system-packages" is added so I don't need to do requirements.txt workaround,
# although I also consider using pipx if we wanted to.
RUN pipx install pipenv \
&& pipenv install --system --no-cache \
# See also https://www.jeffgeerling.com/blog/2023/how-solve-error-externally-managed-environment-when-installing-pip3
RUN rm -rv /usr/lib/python3*/EXTERNALLY-MANAGED \
&& pip install --no-cache \
mkdocs-material \
mkdocs-redirects \
mkdocs-git-committers-plugin-2 \
mkdocs-git-revision-date-localized-plugin \
mkdocs-minify-plugin \
mkdocs-redirects \
mkdocs-rss-plugin \
pillow \
cairosvg
cairosvg \
pipenv
# Trust directory, required for git >= 2.35.2
# Follows the docs for the Docker-based site build setup