- Created a Dockerfile with a multi-stage build process to containerize the application. - Added Makefile for managing build, export, and cleanup tasks.
38 lines
1.1 KiB
Makefile
38 lines
1.1 KiB
Makefile
# Variables
|
|
IMAGE_NAME = white-nights-admin-panel
|
|
IMAGE_TAG = latest
|
|
FULL_IMAGE_NAME = $(IMAGE_NAME):$(IMAGE_TAG)
|
|
ARCHIVE_NAME = white-nights-admin-panel-image.zip
|
|
|
|
# Default target
|
|
.PHONY: help
|
|
help:
|
|
@echo "Available commands:"
|
|
@echo " make build-image - Build Docker image"
|
|
@echo " make export-image - Build Docker image and export it to a zip archive"
|
|
@echo " make clean - Remove Docker image and zip archive"
|
|
@echo " make help - Show this help message"
|
|
|
|
# Build Docker image
|
|
.PHONY: build-image
|
|
build-image:
|
|
@echo "Building Docker image: $(FULL_IMAGE_NAME)"
|
|
docker build -t $(FULL_IMAGE_NAME) .
|
|
|
|
# Export Docker image to zip archive
|
|
.PHONY: export-image
|
|
export-image: build-image
|
|
@echo "Exporting Docker image to $(ARCHIVE_NAME)"
|
|
docker save $(FULL_IMAGE_NAME) | gzip > $(ARCHIVE_NAME)
|
|
@echo "Image exported successfully to $(ARCHIVE_NAME)"
|
|
|
|
# Clean up
|
|
.PHONY: clean
|
|
clean:
|
|
@echo "Removing Docker image and zip archive"
|
|
-docker rmi $(FULL_IMAGE_NAME) 2>/dev/null || true
|
|
-rm -f $(ARCHIVE_NAME) 2>/dev/null || true
|
|
@echo "Clean up completed"
|
|
|
|
# Default target when no arguments provided
|
|
.DEFAULT_GOAL := help
|