Skip to content

Commit

Permalink
Build docker image only for py3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnPreston committed Nov 15, 2023
1 parent 6b23aae commit 2c91974
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 52 deletions.
10 changes: 8 additions & 2 deletions .cicd/buildspec_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ phases:
- REGISTRY_URI=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION:-$AWS_DEFAULT_REGION}.amazonaws.com/
- aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin ${REGISTRY_URI}
- if ! [ -z ${CODEBUILD_RESOLVED_SOURCE_VERSION+x} ]; then COMMIT_HASH=${CODEBUILD_RESOLVED_SOURCE_VERSION::7}; fi
- |
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.20.0/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
- EPOCH=`date +'%Y%m%d'`
- SUFFIX=${COMMIT_HASH:=$EPOCH}
- if [ $USE_EPOCH -eq 1 ]; then SUFFIX=$EPOCH; fi
Expand All @@ -31,8 +37,8 @@ phases:

build:
commands:
- docker-compose -f .cicd/docker-compose.builds.yml build
- docker-compose -f .cicd/docker-compose.builds.yml push
- docker compose -f .cicd/docker-compose.builds.yml build
- docker compose -f .cicd/docker-compose.builds.yml push

finally:
- rm -rfv ~/.docker
24 changes: 3 additions & 21 deletions .cicd/buildspec_manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
privileged-mode: true
variables:
VERSION: 3.7
VERSION: 3.10
ARCH: amd64
buildspec: .cicd/buildspec_image.yml

Expand All @@ -29,7 +29,7 @@ batch:
privileged-mode: true
variables:
ARCH: arm64v8
VERSION: 3.7
VERSION: 3.10
buildspec: .cicd/buildspec_image.yml

- identifier: manifest
Expand Down Expand Up @@ -63,7 +63,7 @@ phases:
build:
commands:
- |
for VERSION in py37 py38 py39 py310; do
for VERSION in py310; do
for ARCH in "amd64" "arm64v8"; do
TAG=${SUFFIX}-${VERSION}-${ARCH}
echo TAG is $TAG
Expand All @@ -76,37 +76,19 @@ phases:
done
- docker manifest create ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py37-amd64
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py37-arm64v8
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py38-amd64
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py38-arm64v8
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py39-amd64
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py39-arm64v8
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py310-amd64
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py310-arm64v8
- docker manifest push ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}

- |
if ! [ $TAG_RELEASE -eq 1 ]; then
docker manifest create ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:nightly \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py37-amd64 \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py37-arm64v8 \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py38-amd64 \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py38-arm64v8 \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py39-amd64 \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py39-arm64v8 \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py310-amd64 \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py310-arm64v8 ;
docker manifest push ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:nightly
else
docker manifest create ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:latest \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py37-amd64 \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py37-arm64v8 \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py38-amd64 \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py38-arm64v8 \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py39-amd64 \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py39-arm64v8 \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py310-amd64 \
--amend ${PUBLIC_REGISTRY}/${REPOSITORY_NAME}:${SUFFIX}-py310-arm64v8 ;
Expand Down
28 changes: 0 additions & 28 deletions .cicd/docker-compose.builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,10 @@
# Docker compose file for the purpose of building images
version: "3.8"
services:
py37:
build:
dockerfile: cli.Dockerfile
context: ../
args:
SRC_TAG: "3.7.20220212"
ARCH: "-${ARCH}"
image: ${REGISTRY_URI}compose-x:${SUFFIX:-main}-py37-${ARCH}

py38:
build:
dockerfile: cli.Dockerfile
context: ../
args:
SRC_TAG: "3.8.20220212"
ARCH: "-${ARCH}"
image: ${REGISTRY_URI}compose-x:${SUFFIX:-main}-py38-${ARCH}

py39:
build:
dockerfile: cli.Dockerfile
context: ../
args:
SRC_TAG: "3.9.20220212"
ARCH: "-${ARCH}"
image: ${REGISTRY_URI}compose-x:${SUFFIX:-main}-py39-${ARCH}

py310:
build:
dockerfile: cli.Dockerfile
context: ../
args:
SRC_TAG: "3.10.20220212"
ARCH: "-${ARCH}"
image: ${REGISTRY_URI}compose-x:${SUFFIX:-main}-py310-${ARCH}
4 changes: 3 additions & 1 deletion cli.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ RUN poetry build
FROM $BASE_IMAGE
COPY --from=builder /opt/dist/ecs_composex-*.whl /opt/
WORKDIR /opt
RUN pip install pip -U --no-cache-dir && pip install wheel --no-cache-dir && pip install *.whl --no-cache-dir;\
RUN pip install pip -U --no-cache-dir && \
pip install wheel --no-cache-dir && \
pip install *.whl --no-cache-dir;\
pip --no-cache-dir install ecs-composex[ecrscan]
WORKDIR /tmp
ENTRYPOINT ["ecs-compose-x"]

0 comments on commit 2c91974

Please sign in to comment.