#!/usr/bin/env sh set -e ENV=${1:-prod} MODE=${2:-no-build} ENVFILE="" if [ -f ".env.$ENV" ]; then ENVFILE="--env-file .env.$ENV"; fi PLATFORM=${PLATFORM:-} if [ -z "$PLATFORM" ]; then ARCH=$(uname -m) case "$ARCH" in x86_64) PLATFORM="linux/amd64" ;; aarch64) PLATFORM="linux/arm64" ;; *) PLATFORM="linux/amd64" ;; esac fi export PLATFORM case "$MODE" in no-build) APP_ENV=$ENV docker compose $ENVFILE up -d ;; rebuild) APP_ENV=$ENV docker compose $ENVFILE build --no-cache APP_ENV=$ENV docker compose $ENVFILE up -d ;; pull) APP_ENV=$ENV docker compose $ENVFILE build --pull APP_ENV=$ENV docker compose $ENVFILE up -d ;; build|*) APP_ENV=$ENV docker compose $ENVFILE up -d --build ;; esac