Skip to content

Commit 7dbb539

Browse files
Include all dockerfiles from jessfraz/dockerfiles
1 parent 500ff61 commit 7dbb539

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

bin/dockerized

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ HOST_PWD=
1414
HOST_HOSTNAME=$(hostname)
1515
HOST_DIR_NAME=$(basename "$PWD")
1616
HOST_DIR_NAME=${HOST_DIR_NAME%/}
17+
SERVICE_NAME=
1718
SERVICE_ARGS=
1819

1920
# PARSE OPTIONS
@@ -32,6 +33,7 @@ CYGWIN* | MINGW32* | MSYS* | MINGW*)
3233
esac
3334

3435
SERVICE_ARGS="$@"
36+
SERVICE_NAME="$1"
3537

3638
function dotenv() {
3739
FILE="$1"
@@ -69,6 +71,23 @@ function loadEnvironment() {
6971

7072
loadEnvironment
7173

74+
SERVICE_EXISTS=$(docker-compose -f "$DOCKERIZED_COMPOSE_FILE" config --services | grep -w $SERVICE_NAME)
75+
76+
if [ -z "$SERVICE_EXISTS" ]; then
77+
echo -e "\033[0;31mCommand $1 is not fully supported. Trying r.j3ss.co/$SERVICE_NAME instead." >&2
78+
echo -e "See https://github.com/jessfraz/dockerfiles/blob/master/README.md for more information.\033[0m" >&2
79+
shift
80+
docker \
81+
run --rm -it \
82+
-w "//host/$HOST_DIR_NAME" \
83+
-v "$HOST_PWD://host/$HOST_DIR_NAME" \
84+
-e "HOST_HOSTNAME=$HOST_HOSTNAME" \
85+
r.j3ss.co/$SERVICE_NAME \
86+
"$@"
87+
88+
exit $?
89+
fi
90+
7291
docker-compose \
7392
--env-file "$DOCKERIZED_ENV_FILE" \
7493
-f "$DOCKERIZED_COMPOSE_FILE" \

0 commit comments

Comments
 (0)