Add Makefile to run Docker container

This commit is contained in:
Radon Rosborough 2020-06-05 19:26:19 -06:00
parent 5e3a4a44fb
commit 9a9ab44755
3 changed files with 26 additions and 0 deletions

View File

@ -2,3 +2,5 @@ FROM ubuntu:rolling
COPY scripts/docker-install.bash /tmp/
RUN /tmp/docker-install.bash
EXPOSE 6119

14
Makefile Normal file
View File

@ -0,0 +1,14 @@
UID := $(shell id -u)
.PHONY: help
help: ## Show this message
@echo "usage:" >&2
@grep -h "[#]# " $(MAKEFILE_LIST) | \
sed 's/^/ make /' | \
sed 's/:[^#]*[#]# /|/' | \
column -t -s'|' >&2
.PHONY: docker
docker: ## Run shell with source code and deps inside Docker
scripts/docker.bash build . -t fast-sandbox --build-arg "UID=$(UID)"
scripts/docker.bash run -it --rm -v "$PWD" -p 6119:6119 fast-sandbox

10
scripts/docker.bash Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
set -o pipefail
if [[ "$OSTYPE" != darwin* ]] && [[ "$EUID" != 0 ]]; then
exec sudo -E docker "$@"
else
exec docker "$@"
fi