-
Notifications
You must be signed in to change notification settings - Fork 69
Script to build docker images locally #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mrutkows
merged 6 commits into
apache:master
from
meenakshimadugula95:update_local_run_dockerfile
Nov 29, 2022
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b4a1bd1
Script to build docker images locally
meenakshimadugulaibm ac9d38a
add license header
meenakshimadugulaibm a918e14
Refactor tutorial
meenakshimadugula95 6135f87
fix whitespace issues in checkstyle
meenakshimadugulaibm 369571c
make readme readable
meenakshimadugulaibm 35b0604
fix build
meenakshimadugulaibm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,81 @@ | ||
#!/bin/bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
helperInstructions() | ||
{ | ||
echo "" | ||
echo "Usage: $0 -r runtimeParameter -t dockerImageTag" | ||
echo -e "\t-r Specific runtime image folder name to be built, it can be one of python3Action, python36AiAction, python39Action or python310Action" | ||
echo -e "\t-t The name for docker image and tag used for building the docker image. Example: action-python-v3.7:1.0-SNAPSHOT" | ||
exit 1 #Exit script | ||
} | ||
|
||
while getopts "r:t:" opt | ||
do | ||
case "$opt" in | ||
r) runtimeParameter="$OPTARG" ;; | ||
t) dockerImageTag="$OPTARG" ;; | ||
[?]) helperInstructions ;; # Print helperInstructions in case parameter is not found | ||
esac | ||
done | ||
|
||
# Print helperInstructions in case parameters are empty | ||
if [ -z "$runtimeParameter" ] || [ -z "$dockerImageTag" ] || ( [[ "$runtimeParameter" != "python3Action" ]] && [[ "$runtimeParameter" != "python36AiAction" ]] && [[ "$runtimeParameter" != "python39Action" ]] && [[ "$runtimeParameter" != "python310Action" ]] ) | ||
then | ||
echo "Runtime parameter is empty or not supported"; | ||
helperInstructions | ||
fi | ||
|
||
# For every runtime 1. copy the required dependent folders 2. build the docker image 3. delete the copied folder | ||
if [[ "$runtimeParameter" == "python3Action" ]] | ||
then | ||
echo "Building docker for python3Action." | ||
cp $(pwd)/core/requirements_common.txt $(pwd)/core/python3Action/requirements_common.txt | ||
docker build -t "$dockerImageTag" $(pwd)/core/python3Action | ||
rm $(pwd)/core/python3Action/requirements_common.txt | ||
elif [[ "$runtimeParameter" == "python36AiAction" ]] | ||
then | ||
echo "Building docker for python36AiAction." | ||
cp $(pwd)/core/requirements_common.txt $(pwd)/core/python36AiAction/requirements_common.txt | ||
cp -r $(pwd)/core/python3Action/bin $(pwd)/core/python36AiAction/bin | ||
cp -r $(pwd)/core/python3Action/lib $(pwd)/core/python36AiAction/lib | ||
docker build -t "$dockerImageTag" $(pwd)/core/python36AiAction | ||
rm $(pwd)/core/python36AiAction/requirements_common.txt | ||
rm -r $(pwd)/core/python36AiAction/bin | ||
rm -r $(pwd)/core/python36AiAction/lib | ||
elif [[ "$runtimeParameter" == "python39Action" ]] | ||
then | ||
echo "Building docker for python39Action." | ||
cp $(pwd)/core/requirements_common.txt $(pwd)/core/python39Action/requirements_common.txt | ||
cp -r $(pwd)/core/python3Action/bin $(pwd)/core/python39Action/bin | ||
cp -r $(pwd)/core/python3Action/lib $(pwd)/core/python39Action/lib | ||
docker build -t "$dockerImageTag" $(pwd)/core/python39Action | ||
rm $(pwd)/core/python39Action/requirements_common.txt | ||
rm -r $(pwd)/core/python39Action/bin | ||
rm -r $(pwd)/core/python39Action/lib | ||
elif [[ "$runtimeParameter" == "python310Action" ]] | ||
then | ||
echo "Building docker for python310Action." | ||
cp $(pwd)/core/requirements_common.txt $(pwd)/core/python310Action/requirements_common.txt | ||
cp -r $(pwd)/core/python3Action/bin $(pwd)/core/python310Action/bin | ||
cp -r $(pwd)/core/python3Action/lib $(pwd)/core/python310Action/lib | ||
docker build -t "$dockerImageTag" $(pwd)/core/python310Action | ||
rm $(pwd)/core/python310Action/requirements_common.txt | ||
rm -r $(pwd)/core/python310Action/bin | ||
rm -r $(pwd)/core/python310Action/lib | ||
fi |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hoping that you could help out and make this markdown more readable?
May wish to align with work in the nodejs runtime's README and docker build/run/test README:
apache/openwhisk-runtime-nodejs#227
Please know further updates to the files there are expected.