33 lines
890 B
Makefile
33 lines
890 B
Makefile
# Define the name for your Docker image
|
|
IMAGE_NAME = drb_server_discord_bot
|
|
|
|
# Default target when you just run 'make'
|
|
all: build
|
|
|
|
# Target to build the Docker image
|
|
build:
|
|
docker build -t $(IMAGE_NAME) .
|
|
|
|
# Target to run the Docker container
|
|
# Requires the DISCORD_BOT_TOKEN environment variable to be set
|
|
run: build
|
|
docker run -it --rm --name $(IMAGE_NAME)_container --network=host -e DISCORD_BOT_TOKEN="${DISCORD_BOT_TOKEN}" $(IMAGE_NAME)
|
|
|
|
# Target to stop the running container
|
|
stop:
|
|
docker stop $(IMAGE_NAME)_container || true
|
|
|
|
# Target to remove the container
|
|
remove:
|
|
docker rm $(IMAGE_NAME)_container || true
|
|
|
|
# Target to clean up the built image
|
|
clean:
|
|
docker rmi $(IMAGE_NAME) || true
|
|
|
|
# Target to stop, remove, and clean everything
|
|
clean_all: stop remove clean
|
|
|
|
# Phony targets to avoid conflicts with files of the same name
|
|
.PHONY: all build run stop remove clean clean_all
|