forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_envoy_docker.sh
More file actions
executable file
·57 lines (44 loc) · 1.59 KB
/
run_envoy_docker.sh
File metadata and controls
executable file
·57 lines (44 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
set -e
# TODO(phlax): Add a check that a usable version of docker compose is available
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Source build SHA information
# shellcheck source=ci/envoy_build_sha.sh
source "${SCRIPT_DIR}/envoy_build_sha.sh"
# User/group IDs
USER_UID="$(id -u)"
USER_GID="$(id -g)"
export USER_UID
export USER_GID
# These should probably go in users .env as docker compose will pick that up
export HTTP_PROXY="${HTTP_PROXY:-${http_proxy:-}}"
export HTTPS_PROXY="${HTTPS_PROXY:-${https_proxy:-}}"
export NO_PROXY="${NO_PROXY:-${no_proxy:-}}"
export GOPROXY="${GOPROXY:-${go_proxy:-}}"
# Docker-in-Docker handling
if [[ -n "$ENVOY_DOCKER_IN_DOCKER" ]]; then
DOCKER_GID="$(stat -c %g /var/run/docker.sock 2>/dev/null || echo "$USER_GID")"
export DOCKER_GID
fi
if [[ -n "$ENVOY_DOCKER_IN_DOCKER" || -n "$ENVOY_SHARED_TMP_DIR" ]]; then
export SHARED_TMP_DIR="${ENVOY_SHARED_TMP_DIR:-/tmp/bazel-shared}"
mkdir -p "${SHARED_TMP_DIR}"
chmod 777 "${SHARED_TMP_DIR}"
fi
if [[ -n "$ENVOY_DOCKER_PLATFORM" ]]; then
echo "Setting Docker platform: ${ENVOY_DOCKER_PLATFORM}"
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
fi
export DOCKER_COMMAND="${*:-bash}"
COMPOSE_SERVICE="envoy-build"
if [[ -n "$MOUNT_GPG_HOME" ]]; then
COMPOSE_SERVICE="envoy-build-gpg"
elif [[ -n "$ENVOY_DOCKER_IN_DOCKER" ]]; then
COMPOSE_SERVICE="envoy-build-dind"
fi
exec docker compose \
-f "${SCRIPT_DIR}/docker-compose.yml" \
${ENVOY_DOCKER_PLATFORM:+-p "$ENVOY_DOCKER_PLATFORM"} \
run \
--rm \
"${COMPOSE_SERVICE}"