UNCLASSIFIED
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Ironbank Containers
G
Galvanize
galvanize
python-code-evaluator
Commits
bf086703
Commit
bf086703
authored
Apr 22, 2021
by
Michael Uranaka
Browse files
Updating repackage scripts. Upgrading to latest python version.
parent
4442f637
Pipeline
#230249
failed with stages
in 4 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
23 deletions
+31
-23
.gitignore
.gitignore
+2
-1
Dockerfile
Dockerfile
+8
-4
hardening_manifest.yaml
hardening_manifest.yaml
+4
-4
scripts/Dockerfile.packages
scripts/Dockerfile.packages
+0
-4
scripts/repackage.sh
scripts/repackage.sh
+17
-10
No files found.
.gitignore
View file @
bf086703
...
...
@@ -8,4 +8,5 @@ test_methods.py
results.txt
mike-run-local-loop.bash
*-local-loop.sh
build_dependencies
\ No newline at end of file
build_dependencies
hardening_manifest.yaml-e
\ No newline at end of file
Dockerfile
View file @
bf086703
ARG
BASE_REGISTRY=registry1.dso.mil
ARG
BASE_IMAGE=opensource/python/python39
ARG
BASE_TAG=3.9.4
FROM
${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}
USER
0
...
...
@@ -10,12 +14,12 @@ COPY ./scripts .
COPY
redis-cli.tar.gz .
# Install redis.
RUN
tar
xzf redis-cli.tar.gz
&&
rm
redis-cli.tar.gz
RUN
mv
redis-cli /usr/local/bin/redis-cli
RUN
tar
xzf redis-cli.tar.gz
&&
rm
redis-cli.tar.gz
\
&&
mv
redis-cli /usr/local/bin/redis-cli
# Set permissions and ownership.
RUN
chown
-R
1001 /app
RUN
chmod
0555 /app/get-job.sh
RUN
chown
-R
1001 /app
\
&&
chmod
0555 /app/get-job.sh
# Become the python user.
USER
1001
...
...
hardening_manifest.yaml
View file @
bf086703
...
...
@@ -8,13 +8,13 @@ name: "galvanize/galvanize/python-code-evaluator"
# The most specific version should be the first tag and will be shown
# on ironbank.dsop.io
tags
:
-
"
0.1.
0
"
-
"
0.1.
1
"
-
"
latest"
# Build args passed to Dockerfile ARGs
args
:
BASE_IMAGE
:
"
opensource/python/python3
8
"
BASE_TAG
:
"
3.
8
"
BASE_IMAGE
:
"
opensource/python/python3
9
"
BASE_TAG
:
"
3.
9.4
"
# Docker image labels
labels
:
...
...
@@ -23,7 +23,7 @@ labels:
org.opencontainers.image.licenses
:
"
proprietary"
org.opencontainers.image.url
:
"
https://www.galvanize.com"
org.opencontainers.image.vendor
:
"
Galvanize"
org.opencontainers.image.version
:
"
3.8
"
org.opencontainers.image.version
:
"
0.1.1
"
mil.dso.ironbank.image.keywords
:
"
lms,learn,galvanize,online,classes,remote,learning"
mil.dso.ironbank.image.type
:
"
commercial"
mil.dso.ironbank.product.name
:
"
Learn"
...
...
scripts/Dockerfile.packages
View file @
bf086703
...
...
@@ -5,10 +5,6 @@ ARG BASE_TAG
FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}
USER 0
ARG NODE_VERSION
ARG YARN_VERSION
ARG JQUERY_RAILS_VERSION
# Install required libs.
RUN dnf update -y && dnf install -y \
curl \
...
...
scripts/repackage.sh
View file @
bf086703
#!/bin/bash
# Image Params.
BASE_REGISTRY
=
registry
.il2
.dso.mil
BASE_IMAGE
=
platform-one/devops/pipeline-templates/ironbank
/python3
8
BASE_TAG
=
3.
8.31
BASE_REGISTRY
=
registry
1
.dso.mil
BASE_IMAGE
=
ironbank/opensource/python
/python3
9
BASE_TAG
=
3.
9.4
# This is the profile name in your aws credentials file.
DEPENDENCY_FOLDER
=
build_dependencies
AWS_PROFILE_NAME
=
r
evacomm
AWS_BUCKET_
NAME
=
learn-dependencies/python-evaluator
AWS_PROFILE_NAME
=
r
c-govcloud
AWS_BUCKET_
URL
=
s3://
learn-dependencies/python-evaluator
AWS_REGION
=
us-gov-west-1
VERSION_NUMBER
=
$(
yq e
'.tags[0]'
../hardening_manifest.yaml
)
echo
"Clearing dependency folder."
rm
-rf
$DEPENDENCY_FOLDER
...
...
@@ -27,20 +28,26 @@ CONTAINER_ID=$(docker run -d "$IMAGE_ID")
echo
"Container ID:
${
CONTAINER_ID
}
"
echo
"Copying node modules and gems to the bundles directory."
docker
cp
"
$CONTAINER_ID
"
:/app/redis-cli.tar.gz
$DEPENDENCY_FOLDER
docker
cp
"
$CONTAINER_ID
"
:/app/redis-cli.tar.gz
"
$DEPENDENCY_FOLDER
/redis-cli-
${
VERSION_NUMBER
}
.tar.gz"
echo
"Stopping the docker container."
docker stop
"
$CONTAINER_ID
"
echo
"Uploading all the build dependencies to AWS."
aws s3
sync
$DEPENDENCY_FOLDER
s3://
$AWS_BUCKET_
NAME
--delete
--profile
$AWS_PROFILE_NAME
--region
$AWS_REGION
#
aws s3 sync $DEPENDENCY_FOLDER $AWS_BUCKET_
URL
--profile $AWS_PROFILE_NAME --region $AWS_REGION
echo
"Checksums:"
cd
$DEPENDENCY_FOLDER
sha256sum
redis-cli.tar.gz
cd
$DEPENDENCY_FOLDER
||
exit
REDIS_CHECKSUM
=
$(
sha256sum
"
redis-cli
-
${
VERSION_NUMBER
}
.tar.gz
"
)
cd
..
echo
"Updating the hardening_manifest.yaml file."
REDIS_PREV_SHA
=
$(
yq
eval
'.resources[] | select(.filename == "redis-cli.tar.gz").validation.value'
../hardening_manifest.yaml
)
REDIS_PREV_URL
=
$(
yq
eval
'.resources[] | select(.filename == "redis-cli.tar.gz").url'
../hardening_manifest.yaml
)
sed
-i
''
-e
"s|
$REDIS_PREV_SHA
|
$REDIS_CHECKSUM
|g"
../hardening_manifest.yaml
sed
-i
''
-e
"s|
$REDIS_PREV_URL
|
${
AWS_BUCKET_URL
}
/redis-cli-
${
VERSION_NUMBER
}
.tar.gz|g"
../hardening_manifest.yaml
echo
"Removing dependency folder."
rm
-rf
$DEPENDENCY_FOLDER
#
rm -rf $DEPENDENCY_FOLDER
echo
"Done!"
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment