mv container launch into Makefile
This commit is contained in:
29
Makefile
29
Makefile
@@ -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
|
||||
|
||||
|
||||
@@ -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
0
custom/010_vanilla_go.sh
Executable file → Normal file
@@ -12,3 +12,5 @@ tree
|
||||
htop
|
||||
iproute2
|
||||
openssh-client
|
||||
vim
|
||||
nano
|
||||
|
||||
Reference in New Issue
Block a user