Files
interview/Makefile

40 lines
837 B
Makefile
Raw Normal View History

2025-05-17 00:25:39 +03:00
BASENAME=interview
2025-05-16 22:25:12 +03:00
2025-05-16 22:11:10 +03:00
IMAGE_NAME=$(BASENAME):latest
2025-05-17 00:25:39 +03:00
MOUNT_DIR=$(shell realpath $(DIR))
help:
$(info make build to build the image)
$(info make run PORT=<port_to_expose> DIR=<dir_to_mount> SECRET=<password_for_ubuntu_user>)
2025-05-16 22:11:10 +03:00
build:
$(info BUILDING IMAGE NAME: $(IMAGE_NAME))
docker build \
-t $(IMAGE_NAME) \
-f Dockerfile .
docker image ls $(IMAGE_NAME)
2025-05-17 00:25:39 +03:00
run: check-env
$(info PORT: $(PORT) MOUNT: ${MOUNT_DIR} PASSWORD: $(SECRET))
docker run -it --rm --name interview \
-h interview \
-m 524288000 \
-e SECRET=$(SECRET) \
-p ${PORT}:22 \
-v ${MOUNT_DIR}:/home/ubuntu/interview:ro \
$(IMAGE_NAME) bash -c read "press Enter to stop"
check-env:
ifndef PORT
$(error no PORT, run make help)
endif
ifndef SECRET
$(error no SECRET, run make help)
endif
ifndef DIR
$(error no DIR, run make help)
endif
2025-05-16 22:11:10 +03:00