Docker build - Just for fun (#203)

* Adding files to run in docker

* Updating build and run scripts with usage

* Updating build and run scripts to check for docker

* Fixing commented code

* Added docker compose file and added instructions
This commit is contained in:
Cory Sayles
2024-08-05 03:54:32 -04:00
committed by GitHub
parent 586205e678
commit 3edd9bd1ca
6 changed files with 131 additions and 0 deletions

34
potato-build.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
# HOW TO BUILD THE POTATO IMAGE
# 1. Run this script and pass in an optional tag for the container
# e.g. ./potato-build.sh 1.0.0
# 2. Alternatively, you can can run using docker compose
# e.g. docker compose run --build potato
# 2a. To pass in an argument, either edit the .env file,
# or set a local environment variable: e.g. export VEGAN="--vegan"
# Tag for the built container
TAG=latest
if ! [ -z $1 ]; then
if [[ $1 == "-h" || $1 == "?" ]]; then
# Print usage
echo "Usage: $0 <tag>"
echo "Example: $0 1.0.0"
exit 0
else
TAG=$1
fi
fi
# Check if Docker is installed
if ! [ -x "$(command -v docker)" ]; then
echo "You need to install Docker."
exit 1
else
echo "Using tag: '$TAG'"
fi
# Perform the build
docker build -t potato:$TAG -f Dockerfile.spud .