-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevcontainer-local-run.sh
More file actions
executable file
·57 lines (50 loc) · 1.31 KB
/
Copy pathdevcontainer-local-run.sh
File metadata and controls
executable file
·57 lines (50 loc) · 1.31 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
#!/usr/bin/env bash
set -euo pipefail
# Syntax: ./devcontainer-local-run.sh [interactive flag]
#
# Usage:
#
# 1. Interactive/debug mode:
#
# ./devcontainer-local-run.sh true
#
# This mode attaches to the container's terminal and runs bash so you can
# inspect the container or run toubleshooting commands. Desktop still runs as
# normal over VNC.
#
# 2. Background mode (default)
#
# ./devcontainer-local-run.sh false
#
# OR
#
# ./devcontainer-local-run.sh
#
# This mode runs the container without attaching to a bash session. Desktop
# runs over VNC.
INTERACTIVE=${1:-"false"}
DOCKER_RUN_MODE="--detach"
CMD=""
if [ "${INTERACTIVE}" == "true" ]; then
DOCKER_RUN_MODE="--interactive --tty"
CMD="/bin/bash"
fi
VARIANT=11
# Some times vendors patch their images and re-release them under the same tag.
# Pulling the image first ensures the cache is fresh with the most recent security updates.
docker pull mcr.microsoft.com/vscode/devcontainers/java:${VARIANT}
# Build the devcontainer for TKP
docker build \
--build-arg VARIANT=${VARIANT} \
--file ./.devcontainer/DOCKERFILE \
--tag devcontainer-tkp \
./.devcontainer
# Run the TKP devcontainer
docker run \
${DOCKER_RUN_MODE} \
--rm \
--publish 6080:6080 \
--init \
--security-opt seccomp=unconfined \
devcontainer-tkp \
${CMD}