Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support docker #50

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM openjdk:8

ADD . /src
WORKDIR /src

RUN ./gradlew executableJar

FROM java:8

#ENV ARTIFACT_SRC=/src/build/libs/pepk.jar

COPY --from=0 /src/build/libs/bundletool-all.jar /app/bundletool-all.jar

ENTRYPOINT ["java", "-jar", "/app/bundletool-all.jar"]
56 changes: 56 additions & 0 deletions docker-bundletool
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
#
# This script will attempt to mirror the host paths by using volumes for the
# following paths:
# * $(pwd)
# * $(dirname $DOCKER_FILE) if it's set
# * $HOME if it's set
#
# You can add additional volumes (or any docker run options) using
# the $DOCKER_OPTIONS environment variable.
#


set -e

IMAGE="yongjhih/bundletool"


# Setup options for connecting to docker host
if [ -z "$DOCKER_HOST" ]; then
DOCKER_HOST="/var/run/docker.sock"
fi
if [ -S "$DOCKER_HOST" ]; then
DOCKER_ADDR="-v $DOCKER_HOST:$DOCKER_HOST -e DOCKER_HOST"
else
DOCKER_ADDR="-e DOCKER_HOST -e DOCKER_TLS_VERIFY -e DOCKER_CERT_PATH"
fi


# Setup volume mounts for compose config and context
if [ "$(pwd)" != '/' ]; then
VOLUMES="-v $(pwd):$(pwd)"
fi
if [ -n "$DOCKER_FILE" ]; then
docker_dir=$(dirname $DOCKER_FILE)
fi
# TODO: also check --file argument
if [ -n "$docker_dir" ]; then
VOLUMES="$VOLUMES -v $docker_dir:$docker_dir"
fi
if [ -n "$HOME" ]; then
#VOLUMES="$VOLUMES -v $HOME:$HOME -v $HOME:/root" # mount $HOME in /root to share docker.config
VOLUMES="$VOLUMES -v $HOME:$HOME" # mount $HOME in /root to share docker.config
fi

# Only allocate tty if we detect one
if [ -t 1 ]; then
DOCKER_RUN_OPTIONS="-t"
fi
if [ -t 0 ]; then
DOCKER_RUN_OPTIONS="$DOCKER_RUN_OPTIONS -i"
fi

#exec docker run --rm $DOCKER_RUN_OPTIONS $DOCKER_ADDR $DOCKER_OPTIONS $VOLUMES -w "$(pwd)" -u $uid:$UID -e HOME=$HOME $IMAGE "$@"
# ?/.gradle
exec docker run --rm $DOCKER_RUN_OPTIONS $DOCKER_ADDR $DOCKER_OPTIONS $VOLUMES -w "$(pwd)" $IMAGE "$@"