mv container launch into Makefile

This commit is contained in:
Dmitry Fedotov
2025-05-17 00:25:39 +03:00
parent 7048561dec
commit 0ec76ba008
4 changed files with 31 additions and 2 deletions

View File

@@ -1,6 +1,11 @@
BASENAME=devenv
BASENAME=interview
IMAGE_NAME=$(BASENAME):latest
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>)
build:
$(info BUILDING IMAGE NAME: $(IMAGE_NAME))
@@ -9,4 +14,26 @@ build:
-f Dockerfile .
docker image ls $(IMAGE_NAME)
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

View File

@@ -5,7 +5,7 @@ if [ "$(ls $1)" ]; then
for script in $1/*
do
echo "executing $script"
$script
bash $script
done
else
echo "custom scripts directory is empty"

0
custom/010_vanilla_go.sh Executable file → Normal file
View File

View File

@@ -12,3 +12,5 @@ tree
htop
iproute2
openssh-client
vim
nano