File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# syntax=docker/dockerfile:1
22
3- FROM gabemendoza1/docker-linuxserver-ubuntu-fips:jammy-22.04 as docker-code-server-python
3+ # ECR and base image configuration - extracted from CodeBuild environment
4+ ARG ECR_ACCOUNT_ID
5+ ARG ECR_REGION
6+ ARG BASE_IMAGE_NAME=docker-linuxserver-ubuntu-fips
7+ ARG BASE_IMAGE_TAG=jammy-22.04
8+ ARG ECR_URI=${ECR_ACCOUNT_ID}.dkr.ecr-fips.${ECR_REGION}.amazonaws.com/${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG}
9+
10+ FROM ${ECR_URI} as docker-code-server-python
411
512ARG DEBIAN_FRONTEND="noninteractive"
613
@@ -19,8 +26,7 @@ RUN echo "**** install Python 3.12 ****" && \
1926 apt-get install -y \
2027 python3.12 \
2128 python3.12-dev \
22- python3.12-venv \
23- python3.12-distutils && \
29+ python3.12-venv && \
2430 update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 && \
2531 update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1 && \
2632 curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12 && \
@@ -31,7 +37,7 @@ RUN echo "**** install Python 3.12 ****" && \
3137 apt-get clean && \
3238 rm -rf \
3339 /var/lib/apt/lists/* \
34- /tmp/*
40+ /tmp/*
3541
3642FROM docker-code-server-python
3743ARG BUILD_DATE
Original file line number Diff line number Diff line change @@ -2,12 +2,15 @@ version: 0.2
22phases :
33 pre_build :
44 commands :
5- - echo Logging in to Amazon ECR...
6- - aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${FIPS_REPOSITORY_URI}
5+ - export DOCKER_BUILDKIT=1
6+ - export ECR_ACCOUNT_ID="$(echo $FIPS_REPOSITORY_URI | cut -d'.' -f1)"
7+ - export ECR_REGION="$(echo $FIPS_REPOSITORY_URI | cut -d'.' -f4)"
78 build :
89 commands :
10+ - echo Logging in to Amazon ECR...
11+ - aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${FIPS_REPOSITORY_URI}
912 - echo Building the Docker image...
10- - docker build -t ${FIPS_REPOSITORY_URI}:latest .
13+ - docker build --build-arg ECR_ACCOUNT_ID=${ECR_ACCOUNT_ID} --build-arg ECR_REGION=${ECR_REGION} - t ${FIPS_REPOSITORY_URI}:latest .
1114 - docker image push --all-tags ${FIPS_REPOSITORY_URI}
1215 post_build :
1316 commands :
Original file line number Diff line number Diff line change 11version : 0.2
22phases :
3+ pre_build :
4+ commands :
5+ - export DOCKER_BUILDKIT=1
6+ - export ECR_ACCOUNT_ID="$(echo $FIPS_REPOSITORY_URI | cut -d'.' -f1)"
7+ - export ECR_REGION="$(echo $FIPS_REPOSITORY_URI | cut -d'.' -f4)"
38 build :
49 commands :
510 - echo Logging in to Amazon ECR...
914 - echo $FIPS_REPOSITORY_URI
1015 - echo $COMMIT_HASH_SHORT
1116 - echo $BRANCH_NAME
12- - docker build --tag ${FIPS_REPOSITORY_URI}:${COMMIT_HASH_SHORT} --tag ${FIPS_REPOSITORY_URI}:${BRANCH_NAME} .
13- # We have a life cycle policy in place to expire and delete images from dev branches,
14- # so there are no issues with pushing as many of these images as there may be.
17+ - docker build --build-arg ECR_ACCOUNT_ID=${ECR_ACCOUNT_ID} --build-arg ECR_REGION=${ECR_REGION} --tag ${FIPS_REPOSITORY_URI}:${COMMIT_HASH_SHORT} --tag ${FIPS_REPOSITORY_URI}:${BRANCH_NAME} .
1518 - docker image push --all-tags ${FIPS_REPOSITORY_URI}
1619 post_build :
1720 commands :
Original file line number Diff line number Diff line change 1-
21version : 0.2
32phases :
3+ pre_build :
4+ commands :
5+ - export DOCKER_BUILDKIT=1
6+ - export ECR_ACCOUNT_ID="$(echo $FIPS_REPOSITORY_URI | cut -d'.' -f1)"
7+ - export ECR_REGION="$(echo $FIPS_REPOSITORY_URI | cut -d'.' -f4)"
48 build :
59 commands :
610 - echo Logging in to Amazon ECR...
711 - aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${FIPS_REPOSITORY_URI}
812 - echo Building the Docker image...
9- - PATCH_TAG=${TAG_NAME#"v"} # major.minor.patch
10- - MINOR_TAG=${PATCH_TAG%.*} # major.minor
11- - MAJOR_TAG=${MINOR_TAG%.*} # major
12- - docker build -t ${FIPS_REPOSITORY_URI}:${PATCH_TAG} -t ${FIPS_REPOSITORY_URI}:${MINOR_TAG} -t ${FIPS_REPOSITORY_URI}:${MAJOR_TAG} .
13+ - PATCH_TAG=${TAG_NAME#"v"}
14+ - MINOR_TAG=${PATCH_TAG%.*}
15+ - MAJOR_TAG=${MINOR_TAG%.*}
16+ - docker build --build-arg ECR_ACCOUNT_ID=${ECR_ACCOUNT_ID} --build-arg ECR_REGION=${ECR_REGION} - t ${FIPS_REPOSITORY_URI}:${PATCH_TAG} -t ${FIPS_REPOSITORY_URI}:${MINOR_TAG} -t ${FIPS_REPOSITORY_URI}:${MAJOR_TAG} .
1317 - docker image push --all-tags ${FIPS_REPOSITORY_URI}
1418 post_build :
1519 commands :
Original file line number Diff line number Diff line change 11---
22services :
33 docker-code-server :
4- image : gabemendoza1/docker-code-server:jammy22.04-python3.12-codeserver-v${CODE_RELEASE:-4.102.1}
4+ image : " ${ECR_ACCOUNT_ID}.dkr.ecr-fips.${ECR_REGION}.amazonaws.com/docker-code-server:${IMAGE_TAG:-local}"
5+ pull_policy : build
56 build :
67 context : .
78 dockerfile : Dockerfile
89 platforms :
910 - linux/amd64
1011 args :
12+ - ECR_ACCOUNT_ID=${ECR_ACCOUNT_ID}
13+ - ECR_REGION=${ECR_REGION:-us-east-1}
14+ - BASE_IMAGE_NAME=${BASE_IMAGE_NAME:-docker-linuxserver-ubuntu-fips}
15+ - BASE_IMAGE_TAG=${BASE_IMAGE_TAG:-jammy-22.04}
1116 - VERSION=${VERSION:-4.102.1}
1217 - CODE_RELEASE=${CODE_RELEASE:-4.102.1}
1318 environment :
You can’t perform that action at this time.
0 commit comments