Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Policy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSDU
OSDU Data Platform
Security and Compliance
Policy
Commits
aad780fc
Commit
aad780fc
authored
2 years ago
by
Marc Burnie [AWS]
Browse files
Options
Downloads
Patches
Plain Diff
Fixing Build Due to Docker Rate Limiting
parent
9c9126ab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!299
Update Dev branch
,
!298
Securityfix
,
!237
Adding Scaling to AWS OPA Deployment
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+1
-1
1 addition, 1 deletion
.gitlab-ci.yml
build/aws/build-aws/Dockerfile
+2
-1
2 additions, 1 deletion
build/aws/build-aws/Dockerfile
build/aws/build-aws/buildspec.yaml
+12
-9
12 additions, 9 deletions
build/aws/build-aws/buildspec.yaml
with
15 additions
and
11 deletions
.gitlab-ci.yml
+
1
−
1
View file @
aad780fc
...
...
@@ -3,7 +3,7 @@ variables:
PYTHONPATH
:
app
PYTEST_DIR
:
app/tests/unit
AWS_BUILD_SUBDIR
:
app
AWS_BUILD_SUBDIR
:
build/aws/build-aws
# AWS_TEST_SUBDIR: testing/storage-test-aws
AWS_SERVICE
:
policy
AWS_SERVICE_NAMESPACE
:
osdu-services
...
...
This diff is collapsed.
Click to expand it.
build/aws/build-aws/Dockerfile
+
2
−
1
View file @
aad780fc
# This Dockerfile assumes you used "make build" to convert the AdminUI to static files in frontend/adminui/dist/policyservice
FROM
python:3.9-slim-buster
FROM
public.ecr.aws/docker/library/
python:3.9-slim-buster
# set environment variables
# PYTHONDONTWRITEBYTECODE - Prevents Python from writing pyc files to disc (equivalent to python -B option)
ENV
PYTHONDONTWRITEBYTECODE 1
# PYTHONUNBUFFERED - Prevents Python from buffering stdout and stderr (equivalent to python -u option)
ENV
PYTHONUNBUFFERED 1
EXPOSE
8080/tcp
WORKDIR
/opt
COPY
./app /opt
...
...
This diff is collapsed.
Click to expand it.
build/aws/build-aws/buildspec.yaml
+
12
−
9
View file @
aad780fc
...
...
@@ -22,23 +22,26 @@ env:
DOCKER_PASSWORD
:
/osdu/devops/docker_credentials:password
phases
:
install
:
runtime-versions
:
nodejs
:
12
commands
:
-
if [ $(echo $CODEBUILD_SOURCE_VERSION | grep -c ^refs/heads.*) -eq 1 ]; then echo "Branch name found"; else echo "This build only supports branch builds" && exit 1; fi
-
apt-get update -y
# Install git secrets
#TODO temporarily adding hotfix, due to https://github.com/awslabs/git-secrets/issues/220
-
export SAY_LOCATION=`ln -s "$(which echo)" say`
-
export PATH="$PATH:$SAY_LOCATION"
-
git clone https://github.com/awslabs/git-secrets.git
-
cd git-secrets && make install && cd ..
-
git secrets --install && git secrets --register-aws
-
npm cache clean -f
-
n stable
-
npm --version
-
n
16
-
npm install -g @angular/cli
pre_build
:
commands
:
-
echo "Logging in to Amazon ECR..."
-
$(aws ecr get-login --no-include-email --region $AWS_REGION)
# authenticate with ECR via the AWS CLI
build
:
commands
:
-
export AWS_ACCOUNT_ID=`aws sts get-caller-identity --query Account --output text`
-
export REPO_NAME=${PWD##*/}
-
export OUTPUT_DIR="dist"
-
export BRANCH_NAME=`echo ${CODEBUILD_SOURCE_VERSION} | awk '{gsub("refs/heads/","");gsub("\\.","-");gsub("[[:space:]]","-")}1' | sed 's/\//-/g' | awk '{print tolower($0)}'`
...
...
@@ -57,7 +60,7 @@ phases:
-
printenv
-
cd app
-
make build
-
make build
_adminui
-
cd ..
-
GIT_SECRETS_SCAN_RESULT=$(git secrets --scan 2> ${OUTPUT_DIR}/git_secrets.out.txt && echo OK || echo FAILED)
...
...
@@ -69,10 +72,10 @@ phases:
-
echo "--Copying Helm Charts to ${OUTPUT_DIR:-dist}--"
-
rsync -r devops/aws/* "${OUTPUT_DIR:-dist}"
-
echo "Logging into
Docker Hub
..."
-
docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
-
echo "Logging in
to
Amazon ECR
..."
-
aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com
# authenticate with ECR via the AWS CLI
-
echo "Building docker image..."
-
docker build -f
app
/Dockerfile -t ${ECR_IMAGE} .
-
docker build -f
build/aws/build-aws
/Dockerfile -t ${ECR_IMAGE} .
-
docker tag ${ECR_IMAGE} ${ECR_IMAGE_BRANCH_LATEST}
-
echo "Pushing docker image..."
-
docker push ${ECR_IMAGE}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment