* Use premade development image. * Use prebuilt container for podman-compose too! * Fix bundle bundle_finished path. * Fix docker-compose to work with the Multistage Containerfile Add root user for Forem containers, fix bundle_finished path and make webpacker wait for the bundle to finish. Switch Redis to redis:6.0.9-alpine * Remove build steps and fix bundle path. * Merge dev entrypoint into the main one. * Use merged entrypoint.sh, remove old entrypoint directives, and fix a dockerize bug. * Make sure unset BUNDLE_WITHOUT and remove without in bundle config. * Unset BUNDLE_WITHOUT="development:test" as a global ENV. Also ensure that we remove the without directives for development and testing. This will make sure that the right gems are installed for each environment. Removed some unneeded COPYs and remove a commented out RUN. * Fix ENTRYPOINT on development and testing containers. * Fix entrypoint and command on rails container. * Ignore bundle_finished file. * Fix REDIS_ env vars and adjust podman-compose file. * Change bundle_finished path and update Yarn docker-compose command.
93 lines
2.3 KiB
Bash
Executable file
93 lines
2.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
if hash docker 2>/dev/null; then
|
|
CONTAINER_RUNTIME=docker
|
|
else
|
|
|
|
echo "Error! We could not find docker on your Mac!"
|
|
echo "Please install Docker for Mac:"
|
|
echo "https://docs.docker.com/docker-for-mac/install/"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if hash docker-compose 2>/dev/null; then
|
|
CONTAINER_COMPOSE=docker-compose
|
|
else
|
|
|
|
echo "Error! We could not find a docker-compose on your Mac!"
|
|
echo "Please install Docker for Mac:"
|
|
echo "https://docs.docker.com/docker-for-mac/install/"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
|
|
if hash podman 2>/dev/null; then
|
|
CONTAINER_RUNTIME=podman
|
|
elif hash docker 2>/dev/null; then
|
|
CONTAINER_RUNTIME=docker
|
|
else
|
|
|
|
echo "Error! We could not find a container runtime on your Linux install!"
|
|
echo "Please install Podman v1.9.3 or greater:"
|
|
echo "https://podman.io/getting-started/installation.html"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if hash podman-compose 2>/dev/null; then
|
|
CONTAINER_COMPOSE=podman-compose
|
|
elif hash docker 2>/dev/null; then
|
|
CONTAINER_COMPOSE=docker-compose
|
|
else
|
|
|
|
echo "Error! We could not find ${CONTAINER_COMPOSE} on your Linux install!"
|
|
echo "Please install Podman Compose:"
|
|
echo "https://github.com/containers/podman-compose#installation"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Oof! Sorry! This OS is unsupported! :("
|
|
|
|
fi
|
|
|
|
echo "Starting the Forem container stack..."
|
|
|
|
if [ "${CONTAINER_RUNTIME}" = "docker" ]; then
|
|
|
|
if [[ ! -d vendor/bundle || ! "$(ls -A vendor/bundle)" ]]; then
|
|
echo "The vendor/bundle directory is empty or does not exist."
|
|
echo "This will cause bundle install to run which takes a long time with ${CONTAINER_RUNTIME}."
|
|
echo "Depending on your hardware specs, the initial setup can take"
|
|
echo "30 to 45 minutes. Please stand by..."
|
|
sleep 10
|
|
fi
|
|
|
|
docker-compose up
|
|
|
|
elif [ "${CONTAINER_RUNTIME}" = "podman" ]; then
|
|
|
|
if podman pod exists forem; then
|
|
echo "The forem pod is already setup. Please run:"
|
|
echo ""
|
|
echo "podman-compose -p forem -f container-compose.yml down"
|
|
echo ""
|
|
echo "to bring down the Forem container stack before running container-setup."
|
|
else
|
|
podman-compose -p forem -f container-compose.yml up
|
|
fi
|
|
|
|
fi
|