mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2024-11-23 03:21:28 +01:00
update dockerfile
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
parent
7b5ef7166f
commit
43fab0cce2
21
Makefile
21
Makefile
|
@ -1,24 +1,37 @@
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: ## Builds all the dockerfiles in the repository.
|
build: ## Builds all the dockerfiles in the repository.
|
||||||
./build-all.sh
|
@$(CURDIR)/build-all.sh
|
||||||
|
|
||||||
.PHONY: latest-versions
|
.PHONY: latest-versions
|
||||||
latest-versions: ## Checks all the latest versions of the Dockerfile contents.
|
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
|
.PHONY: test
|
||||||
test: shellcheck dockerfiles ## Runs the tests on the repository.
|
test: shellcheck dockerfiles ## Runs the tests on the repository.
|
||||||
|
|
||||||
.PHONY: dockerfiles
|
.PHONY: dockerfiles
|
||||||
dockerfiles: ## Tests the changes to the Dockefiles build.
|
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
|
# 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
|
# TTY, which would fail, but if it is interactive, we do want to attach
|
||||||
# so that the user can send e.g. ^C through.
|
# so that the user can send e.g. ^C through.
|
||||||
INTERACTIVE := $(shell [ -t 0 ] && echo 1 || echo 0)
|
INTERACTIVE := $(shell [ -t 0 ] && echo 1 || echo 0)
|
||||||
ifeq ($(INTERACTIVE), 1)
|
ifeq ($(INTERACTIVE), 1)
|
||||||
DOCKER_FLAGS += -t
|
DOCKER_FLAGS += -t
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: shellcheck
|
.PHONY: shellcheck
|
||||||
|
|
19
run.sh
19
run.sh
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# This script allows you to launch several images
|
# This script allows you to launch several images
|
||||||
# from this repository once they're built.
|
# from this repository once they're built.
|
||||||
|
@ -8,29 +8,32 @@
|
||||||
# can find it and execute it.
|
# can find it and execute it.
|
||||||
#
|
#
|
||||||
# Use pulseaudio/Dockerfile and skype/Dockerfile as examples.
|
# 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 ..."
|
echo "Usage: $0 [--test] image1 image2 ..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "--test" ]; then
|
if [[ "$1" = "--test" ]]; then
|
||||||
TEST=1
|
TEST=1
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for name in "$@"; do
|
for name in "$@"; do
|
||||||
if [ ! -d $name ]; then
|
if [[ ! -d "$name" ]]; then
|
||||||
echo "unable to find container configuration with name $name"
|
echo "Unable to find container configuration with name: $name"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
if [ $TEST ]; then
|
||||||
echo $script
|
echo "$script"
|
||||||
else
|
else
|
||||||
eval $script
|
eval "$script"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
shift
|
shift
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# command to run Telnet
|
# command to run Telnet
|
||||||
# docker run -it --rm \
|
# docker run -it --rm \
|
||||||
# --log-driver none \
|
# --log-driver none \
|
||||||
# jess/telnet "$@"
|
# jess/telnet towel.blinkenlights.nl
|
||||||
#
|
#
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
LABEL maintainer "Jessie Frazelle <jess@linux.com>"
|
LABEL maintainer "Jessie Frazelle <jess@linux.com>"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user