Last active
May 19, 2020 23:25
-
-
Save jalakoo/91a7dee61554a0c51bf5459ff90493c4 to your computer and use it in GitHub Desktop.
Bash script for quickly creating a standalone alwaysai docker image
This file contains 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
#!/bin/bash | |
# If this file is in your project root dir `aai app deploy` | |
# will copy this to the target device app root directory. | |
# Then either run this on the target deployment device | |
# with ./build_standalone.sh by direct ssh or by using | |
# `aai app shell --no-container` from your dev machine. | |
# Additional information at https://dashboard.alwaysai.co/docs/application_development/packaging_app_as_docker_image.html | |
echo 'Image name for standalone file? (no spaces)' | |
read image_name | |
cp Dockerfile Dockerfile.standalone | |
echo ''>>Dockerfile.standalone | |
echo 'WORKDIR /app'>>Dockerfile.standalone | |
echo 'COPY . ./'>>Dockerfile.standalone | |
echo 'RUN pip3 install -r requirements.txt'>>Dockerfile.standalone | |
echo 'CMD ["python3", "app.py"]'>>Dockerfile.standalone | |
if docker build -t $image_name -f Dockerfile.standalone .; then | |
echo 'Build complete' | |
echo 'To run the image use: docker run --rm --network=host --privileged -v /dev:/dev '$image_name ' OR ' | |
echo './start_standalone.sh' | |
else | |
echo 'Unknown problem building image. Exit status: $?' | |
fi | |
# Create convenience start script | |
echo '#!/bin/bash' >> start_standalone.sh | |
echo 'docker run --rm --network=host --privileged -v /dev:/dev '$image_name >> start_standalone.sh | |
chmod +x ./start_standalone.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment