diff options
author | Eric Anderson <ejona@google.com> | 2018-03-28 17:15:36 -0700 |
---|---|---|
committer | Eric Anderson <ejona@google.com> | 2018-03-28 17:24:07 -0700 |
commit | cdbfdd8da86be37e9150f55982c291f4a02e2ecb (patch) | |
tree | 1519cf41a1ee055face25a9f32fbe33e2d5b6bba /protoc-artifacts | |
parent | 67c1cd4cb7d347241bc7a9e6989a0a6a062e4607 (diff) | |
download | protobuf-cdbfdd8da86be37e9150f55982c291f4a02e2ecb.tar.gz |
protoc-artifacts: Use ENTRYPOINT to enable devtoolset-1.1
ENTRYPOINT is used even when other commands are specified on the "docker
run" command line. This allows running one-off commands in the docker
image (especially combined with volume binding with the host) with the
correct environment variables.
Diffstat (limited to 'protoc-artifacts')
-rw-r--r-- | protoc-artifacts/Dockerfile | 4 | ||||
-rw-r--r-- | protoc-artifacts/README.md | 2 | ||||
-rwxr-xr-x | protoc-artifacts/scl-enable-devtoolset.sh | 13 |
3 files changed, 17 insertions, 2 deletions
diff --git a/protoc-artifacts/Dockerfile b/protoc-artifacts/Dockerfile index 264469376..c346586b1 100644 --- a/protoc-artifacts/Dockerfile +++ b/protoc-artifacts/Dockerfile @@ -39,5 +39,7 @@ RUN wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo -P /etc/yum devtoolset-1.1-libstdc++-devel.i686 && \ yum clean all +COPY scl-enable-devtoolset.sh /var/local/ + # Start in devtoolset environment that uses GCC 4.7 -CMD ["scl", "enable", "devtoolset-1.1", "bash"] +ENTRYPOINT ["/var/local/scl-enable-devtoolset.sh"] diff --git a/protoc-artifacts/README.md b/protoc-artifacts/README.md index d11cde5d0..dcaec9877 100644 --- a/protoc-artifacts/README.md +++ b/protoc-artifacts/README.md @@ -140,7 +140,7 @@ $ docker build -t protoc-artifacts . To run the image: ``` -$ docker run -it --rm=true protoc-artifacts +$ docker run -it --rm=true protoc-artifacts bash ``` To checkout protobuf (run within the container): diff --git a/protoc-artifacts/scl-enable-devtoolset.sh b/protoc-artifacts/scl-enable-devtoolset.sh new file mode 100755 index 000000000..8d9585eab --- /dev/null +++ b/protoc-artifacts/scl-enable-devtoolset.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -eu -o pipefail + +quote() { + local arg + for arg in "$@"; do + printf "'" + printf "%s" "$arg" | sed -e "s/'/'\\\\''/g" + printf "' " + done +} + +exec scl enable devtoolset-1.1 "$(quote "$@")" |