Slimming down

This commit is contained in:
2025-10-30 14:55:37 +01:00
parent 3678efed07
commit f881c13df3
10 changed files with 852 additions and 24 deletions

View File

@@ -68,15 +68,37 @@ check_compose() {
build() {
print_info "Building container image..."
# Use Containerfile if it exists, otherwise fall back to Dockerfile
if [ -f "Containerfile" ]; then
BUILD_FILE="Containerfile"
# Detect architecture
ARCH=$(uname -m)
print_info "Detected architecture: ${ARCH}"
# Choose appropriate Dockerfile based on architecture and availability
if [ -f "Dockerfile.minimal" ]; then
BUILD_FILE="Dockerfile.minimal"
print_info "Using minimal Dockerfile (no compilation required)"
elif [ "$ARCH" = "armv6l" ] || [ "$ARCH" = "armv7l" ] || [ "$ARCH" = "aarch64" ]; then
# ARM architecture (Raspberry Pi, etc.)
if [ -f "Dockerfile.arm" ]; then
BUILD_FILE="Dockerfile.arm"
print_info "Using ARM-optimized Dockerfile"
elif [ -f "Containerfile" ]; then
BUILD_FILE="Containerfile"
else
BUILD_FILE="Dockerfile"
fi
else
BUILD_FILE="Dockerfile"
# x86_64 or other architectures
if [ -f "Containerfile" ]; then
BUILD_FILE="Containerfile"
else
BUILD_FILE="Dockerfile"
fi
fi
print_info "Using build file: ${BUILD_FILE}"
${RUNTIME} build -f ${BUILD_FILE} -t ${IMAGE_NAME} . || {
print_error "Failed to build container image"
print_info "Try using Dockerfile.minimal with simplified dependencies"
exit 1
}
print_success "Container image built successfully"
@@ -226,7 +248,7 @@ generate_systemd() {
show_help() {
echo "Turmli Bar Calendar - Podman Deployment Script"
echo ""
echo "Usage: $0 {build|start|stop|restart|logs|status|clean|systemd|help}"
echo "Usage: $0 {build|start|stop|restart|logs|status|clean|systemd|info|help}"
echo ""
echo "Commands:"
echo " build - Build the container image"
@@ -237,11 +259,57 @@ show_help() {
echo " status - Check application status"
echo " clean - Remove containers and images"
echo " systemd - Generate systemd service (Podman only)"
echo " info - Show system and architecture information"
echo " help - Show this help message"
echo ""
echo "Environment Variables:"
echo " PORT - Port to expose (default: 8000)"
echo " TZ - Timezone (default: Europe/Berlin)"
echo ""
echo "Architecture Notes:"
echo " Dockerfile.minimal - Works on all architectures (no compilation)"
echo " Dockerfile.arm - ARM-optimized with simplified dependencies"
echo " Dockerfile - Standard multi-stage build (requires compilation)"
}
# Show system information
show_info() {
echo -e "${BLUE}System Information:${NC}"
echo " Architecture: $(uname -m)"
echo " OS: $(uname -s)"
echo " Kernel: $(uname -r)"
if command -v podman &> /dev/null; then
echo ""
echo -e "${BLUE}Podman Information:${NC}"
podman version --format " Version: {{.Client.Version}}"
podman info --format " Storage Driver: {{.Store.GraphDriverName}}"
podman info --format " Root: {{.Store.GraphRoot}}"
fi
if command -v docker &> /dev/null; then
echo ""
echo -e "${BLUE}Docker Information:${NC}"
docker version --format " Version: {{.Client.Version}}" 2>/dev/null || echo " Docker daemon not accessible"
fi
echo ""
echo -e "${BLUE}Build Configuration:${NC}"
ARCH=$(uname -m)
if [ -f "Dockerfile.minimal" ]; then
echo " Will use: Dockerfile.minimal (no compilation required)"
echo " Perfect for: All architectures including ARM/Raspberry Pi"
elif [ "$ARCH" = "armv6l" ] || [ "$ARCH" = "armv7l" ] || [ "$ARCH" = "aarch64" ]; then
echo " ARM architecture detected"
if [ -f "Dockerfile.arm" ]; then
echo " Will use: Dockerfile.arm (simplified dependencies)"
else
echo " Will use: Standard Dockerfile (may require longer build time)"
fi
else
echo " x86_64/standard architecture detected"
echo " Will use: Dockerfile or Containerfile"
fi
}
# Main script
@@ -284,6 +352,9 @@ case "$1" in
check_container_runtime
generate_systemd
;;
info)
show_info
;;
help)
show_help
;;