-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinstall-teamcity-server-on-docker.bash
executable file
·52 lines (52 loc) · 1.93 KB
/
install-teamcity-server-on-docker.bash
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
#!/bin/bash
set -eo pipefail
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
cd "$SCRIPT_DIR"
. ../shared.bash
SERVICE_PORT="8111"
# Cleanup
echo "]] Cleaning up the previous TeamCity installation"
execute-docker-compose down &>/dev/null || true
docker stop $TEAMCITY_DOCKER_CONTAINER_NAME &>/dev/null || true
docker rm $TEAMCITY_DOCKER_CONTAINER_NAME &>/dev/null || true
rm -rf $TEAMCITY_DOCKER_DATA_DIR
rm -rf docker-compose.yml
rm -rf $HOME/$TEAMCITY_DOCKER_CONTAINER_NAME.tar.gz
# Install
if [[ $1 != "--uninstall" ]]; then
echo "]] Starting the TeamCity Docker container"
curl -o $HOME/$TEAMCITY_DOCKER_CONTAINER_NAME-data.tar.gz https://downloads.veertu.com/anka/$TEAMCITY_DOCKER_CONTAINER_NAME-data.tar.gz
pushd $HOME
tar -xzf $TEAMCITY_DOCKER_DATA_DIR.tar.gz
rm -rf $HOME/$TEAMCITY_DOCKER_CONTAINER_NAME.tar.gz
popd
cat > docker-compose.yml <<BLOCK
version: '3.7'
services:
$TEAMCITY_DOCKER_CONTAINER_NAME:
container_name: $TEAMCITY_DOCKER_CONTAINER_NAME
image: jetbrains/teamcity-server:$TEAMCITY_DOCKER_TAG_VERSION
restart: always
ports:
- "$TEAMCITY_PORT:$SERVICE_PORT"
volumes:
- $TEAMCITY_DOCKER_DATA_DIR:/data/teamcity_server
- $TEAMCITY_DOCKER_DATA_DIR/logs:/opt/teamcity/logs
environment:
TEAMCITY_SERVER_MEM_OPTS: "-Xmx1240m"
TEAMCITY_SERVER_OPTS: "-Dteamcity.kotlinConfigsDsl.pluginsCompilationXmx=512m"
BLOCK
if [[ "$(uname)" == "Linux" ]]; then
cat >> docker-compose.yml <<BLOCK
extra_hosts:
- "host.docker.internal:host-gateway"
BLOCK
fi
execute-docker-compose up -d
# docker logs --tail 100 $DOCKER_CONTAINER_NAME
modify_hosts $TEAMCITY_DOCKER_CONTAINER_NAME
echo "============================================================================"
echo "Teamcity UI: ${URL_PROTOCOL}$TEAMCITY_DOCKER_CONTAINER_NAME:$TEAMCITY_PORT
Logins: admin / admin
Documentation: https://docs.veertu.com/anka/intel/ci-plugins-and-integrations/teamcity"
fi