update dockerfile

Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
Jess Frazelle 2018-09-24 19:03:07 -04:00
parent 7b5ef7166f
commit 43fab0cce2
No known key found for this signature in database
GPG Key ID: 18F3685C0022BFF3
3 changed files with 29 additions and 13 deletions

View File

@ -1,24 +1,37 @@
.PHONY: build
build: ## Builds all the dockerfiles in the repository.
./build-all.sh
@$(CURDIR)/build-all.sh
.PHONY: latest-versions
latest-versions: ## Checks all the latest versions of the Dockerfile contents.
./latest-versions.sh
@$(CURDIR)/latest-versions.sh
check_defined = \
$(strip $(foreach 1,$1, \
$(call __check_defined,$1,$(strip $(value 2)))))
__check_defined = \
$(if $(value $1),, \
$(error Undefined $1$(if $2, ($2))$(if $(value @), \
required by target `$@')))
.PHONY: run
run: ## Run a Dockerfile from the command at the top of the file (ex. DIR=telnet).
@:$(call check_defined, DIR, directory of the Dockefile)
@$(CURDIR)/run.sh "$(DIR)"
.PHONY: test
test: shellcheck dockerfiles ## Runs the tests on the repository.
.PHONY: dockerfiles
dockerfiles: ## Tests the changes to the Dockefiles build.
./test.sh
@$(CURDIR)/test.sh
# if this session isn't interactive, then we don't want to allocate a
# TTY, which would fail, but if it is interactive, we do want to attach
# so that the user can send e.g. ^C through.
INTERACTIVE := $(shell [ -t 0 ] && echo 1 || echo 0)
ifeq ($(INTERACTIVE), 1)
DOCKER_FLAGS += -t
DOCKER_FLAGS += -t
endif
.PHONY: shellcheck

19
run.sh
View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# This script allows you to launch several images
# from this repository once they're built.
@ -8,29 +8,32 @@
# can find it and execute it.
#
# Use pulseaudio/Dockerfile and skype/Dockerfile as examples.
set -e
set -o pipefail
if [ $# -eq 0 ]; then
if [[ $# -eq 0 ]]; then
echo "Usage: $0 [--test] image1 image2 ..."
exit 1
fi
if [ "$1" = "--test" ]; then
if [[ "$1" = "--test" ]]; then
TEST=1
shift
fi
for name in "$@"; do
if [ ! -d $name ]; then
echo "unable to find container configuration with name $name"
if [[ ! -d "$name" ]]; then
echo "Unable to find container configuration with name: $name"
exit 1
fi
script=`sed -n '/docker run/,/^#$/p' $name/Dockerfile | head -n -1 | sed -e 's/\#//' | sed -e 's/\\\//'`
script=$(sed -n '/docker run/,/^#$/p' "$name/Dockerfile" | head -n -1 | sed "s/#//" | sed "s#\\\##" | tr '\n' ' ' | sed "s/\$@//" | sed 's/""//')
echo "Running: $script"
if [ $TEST ]; then
echo $script
echo "$script"
else
eval $script
eval "$script"
fi
shift

View File

@ -1,7 +1,7 @@
# command to run Telnet
# docker run -it --rm \
# --log-driver none \
# jess/telnet "$@"
# jess/telnet towel.blinkenlights.nl
#
FROM alpine:latest
LABEL maintainer "Jessie Frazelle <jess@linux.com>"