File size: 2,368 Bytes
be56d87 acfee14 be56d87 acfee14 be56d87 acfee14 be56d87 acfee14 be56d87 acfee14 be56d87 acfee14 be56d87 acfee14 be56d87 acfee14 be56d87 acfee14 be56d87 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# -----------------------------
# Variables
# -----------------------------
IMAGE_NAME = llmdataparser
CONTAINER_NAME = llmdataparser
VERSION = latest
# -----------------------------
# Docker Basic Commands
# -----------------------------
# Build the Docker image
build:
docker build -t $(IMAGE_NAME):$(VERSION) .
# Run the container
run:
docker run -d -p 7860:7860 --name $(CONTAINER_NAME) $(IMAGE_NAME):$(VERSION)
# Stop the container
stop:
docker stop $(CONTAINER_NAME)
# Remove the container
rm:
docker rm $(CONTAINER_NAME)
# Remove the image
rmi:
docker rmi $(IMAGE_NAME):$(VERSION)
# -----------------------------
# Docker Compose Commands
# -----------------------------
# Start with docker-compose (development)
compose-up:
docker compose up -d
# Stop and remove containers
compose-down:
docker compose down
# View logs
compose-logs:
docker compose logs -f
# Rebuild containers
compose-build:
docker compose build
# Restart containers
compose-restart:
docker compose restart
# -----------------------------
# Convenience Commands
# -----------------------------
# Build and run with docker
up: build run
# Stop and remove container
down: stop rm
# Clean everything
clean: stop rm rmi
# -----------------------------
# Monitoring Commands
# -----------------------------
# Show container logs
logs:
docker logs $(CONTAINER_NAME)
# Follow container logs
logs-follow:
docker logs -f $(CONTAINER_NAME)
# Show container status
status:
docker ps -a | grep $(CONTAINER_NAME)
# Enter container shell
shell:
docker exec -it $(CONTAINER_NAME) /bin/bash
# -----------------------------
# Production Commands
# -----------------------------
# Test nginx configuration (for production use)
nginx-test:
docker compose run --rm nginx nginx -t
# Start with nginx test (for production use)
compose-up-prod: nginx-test compose-up
# -----------------------------
# Security Commands
# -----------------------------
security-check:
@echo "Checking nginx configuration..."
docker compose run --rm nginx nginx -t
@echo "Checking exposed ports..."
docker compose config | grep -E "ports:|127.0.0.1"
# Ensure all targets are treated as commands, not files
.PHONY: build run stop rm rmi clean up down logs shell \
compose-up compose-down compose-logs compose-build compose-restart \
nginx-test status logs-follow compose-up-prod
|