Add Makefile to run Docker container
This commit is contained in:
parent
5e3a4a44fb
commit
9a9ab44755
|
@ -2,3 +2,5 @@ FROM ubuntu:rolling
|
||||||
|
|
||||||
COPY scripts/docker-install.bash /tmp/
|
COPY scripts/docker-install.bash /tmp/
|
||||||
RUN /tmp/docker-install.bash
|
RUN /tmp/docker-install.bash
|
||||||
|
|
||||||
|
EXPOSE 6119
|
||||||
|
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue