Skip to content

Commit

Permalink
Upgrade psycopg2-binary to a version with arm64 packages prebuilt. Re…
Browse files Browse the repository at this point in the history
…vert a bunch of build hacks as a result
  • Loading branch information
gsoltis committed Jun 25, 2021
1 parent 2399afa commit 2adfa40
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ typed-ast = "*"

[packages]
sqlalchemy = "==1.3.13"
psycopg2-binary = "==2.8.6"
jmespath = "==0.9.4"
jsonpatch = "==1.25"
pyyaml = "==5.4"
Expand All @@ -30,6 +29,7 @@ colr = "*"
python-dateutil = "*"
boto3 = "==1.17.9"
botocore = "==1.20.9"
psycopg2-binary = "==2.9.1"

[requires]
python_version = "3.9"
4 changes: 2 additions & 2 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions docker/Dockerfile-arm
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ FROM python:3.9-slim

ADD /~https://github.com/amacneil/dbmate/releases/download/v1.11.0/dbmate-linux-arm64 /app/dbmate
RUN chmod a+x /app/dbmate
RUN apt-get update && apt-get install -y libpq-dev
COPY requirements.txt /app/
COPY migrations /app/migrations
WORKDIR /app/
RUN pip install -r requirements.txt
COPY psycopg2_binary-2.8.6-cp39-cp39-linux_aarch64.whl /app/
RUN pip install /app/psycopg2_binary-2.8.6-cp39-cp39-linux_aarch64.whl
EXPOSE 5000/tcp
COPY introspector.py /app/
COPY introspector /app/introspector
Expand Down
16 changes: 1 addition & 15 deletions docker/build_arm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,9 @@ set -e
PACKAGE=$1
VERSION=$2

export DOCKER_BUILDKIT=1
WHEEL_TAG=goldfig/tempbuildwheel:latest
docker build --platform linux/arm64 -f docker/BuildWheelDockerFile -t $WHEEL_TAG .

CONTAINER_ID=$(docker run -t -d --rm $WHEEL_TAG)
echo "Container ID $CONTAINER_ID"
WHEEL_FILE=$(docker exec $CONTAINER_ID /usr/local/bin/pip cache list --format abspath)
echo "Wheel file $WHEEL_FILE"
LOCAL_WHEEL=psycopg2_binary-2.8.6-cp39-cp39-linux_aarch64.whl
docker cp $CONTAINER_ID:$WHEEL_FILE $LOCAL_WHEEL
docker stop $CONTAINER_ID

echo "Building package ${PACKAGE}"

pipenv lock -r > requirements.tmp
sed '/psycopg2-binary.*/d' requirements.tmp > requirements.txt
rm requirements.tmp
pipenv lock -r > requirements.txt

INTROSPECTOR_DOCKER_REPO=${DOCKER_REPO:-goldfig}
IMAGE="${INTROSPECTOR_DOCKER_REPO}/${PACKAGE}:arm64-${VERSION}"
Expand Down

0 comments on commit 2adfa40

Please sign in to comment.