-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build infrastructure for multi-architecture docker image
- Loading branch information
Greg Soltis
committed
Mar 12, 2021
1 parent
9ac8250
commit f935b0d
Showing
8 changed files
with
70 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ __pycache__/ | |
/gf | ||
dist/ | ||
dbmate | ||
*.whl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM python:3.9-buster | ||
|
||
RUN pip install psycopg2-binary |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
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 | ||
LABEL introspector-cli=0.0.1 | ||
|
||
ENTRYPOINT ["/app/introspector.py", "serve"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
set -e | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
${DIR}/build_arm.sh introspector | ||
${DIR}/build_amd.sh introspector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
set -e | ||
|
||
PACKAGE=$1 | ||
|
||
echo "Building package ${PACKAGE}" | ||
|
||
pipenv lock -r > requirements.txt | ||
|
||
INTROSPECTOR_DOCKER_REPO=${DOCKER_REPO:-goldfig} | ||
IMAGE="${INTROSPECTOR_DOCKER_REPO}/${PACKAGE}:amd64-latest" | ||
DOCKER_BUILDKIT=1 docker build --platform linux/amd64 -t ${IMAGE} -f docker/Dockerfile-amd . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
PACKAGE=$1 | ||
|
||
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 | ||
|
||
#PACKAGE=`basename $DIR` | ||
|
||
echo "Building package ${PACKAGE}" | ||
|
||
pipenv lock -r > requirements.tmp | ||
sed '/psycopg2-binary.*/d' requirements.tmp > requirements.txt | ||
rm requirements.tmp | ||
|
||
INTROSPECTOR_DOCKER_REPO=${DOCKER_REPO:-goldfig} | ||
IMAGE="${INTROSPECTOR_DOCKER_REPO}/${PACKAGE}:arm64-latest" | ||
DOCKER_BUILDKIT=1 docker build -f docker/Dockerfile-arm --platform linux/arm64 -t ${IMAGE} . | ||
|
||
echo "Built ${IMAGE}" |