make - autocommit

This commit is contained in:
Anatolii Zimovskii 2023-07-01 14:52:07 +03:00
parent 8c356f2503
commit 75b0d4836e
Signed by: stam
GPG Key ID: E149C3760CFA3C7E
27 changed files with 837 additions and 6 deletions

View File

@ -442,10 +442,12 @@ ecosystem-postgres-images:
# cd `pwd`/linux/ecosystem/postgres/16 && pwd && make build && make deploy
ecosystem-teamcity-agent-images:
cd `pwd`/linux/ecosystem/teamcity/agent/latest && pwd && make build && make deploy
cd `pwd`/linux/ecosystem/teamcity/agent/latest/jdk11 && pwd && make build && make deploy
cd `pwd`/linux/ecosystem/teamcity/agent/latest/jdk17 && pwd && make build && make deploy
cd `pwd`/linux/ecosystem/teamcity/agent/amxx-sdk/1.9 && pwd && make build && make deploy
cd `pwd`/linux/ecosystem/teamcity/agent/amxx-sdk/1.10 && pwd && make build && make deploy
cd `pwd`/linux/ecosystem/teamcity/agent/android-sdk && pwd && make build && make deploy
cd `pwd`/linux/ecosystem/teamcity/agent/android-sdk/jdk11 && pwd && make build && make deploy
cd `pwd`/linux/ecosystem/teamcity/agent/android-sdk/jdk17 && pwd && make build && make deploy
cd `pwd`/linux/ecosystem/teamcity/agent/atlassian-sdk && pwd && make build && make deploy
cd `pwd`/linux/ecosystem/teamcity/agent/dotnet-sdk && pwd && make build && make deploy
cd `pwd`/linux/ecosystem/teamcity/agent/node10 && pwd && make build && make deploy

View File

@ -1,18 +1,18 @@
FROM epicmorg/teamcity-agent:latest
FROM epicmorg/teamcity-agent:latest-jdk17
LABEL maintainer="EpicMorg DevTeam, developer@epicm.org"
ARG DEBIAN_FRONTEND=noninteractive
ENV ANDROID_HOME=/usr/lib/android-sdk
ENV ANDROID_SDK_ROOT=/usr/lib/android-sdk
ENV GRADLE_VERSION=7.4.2
ENV GRADLE_VERSION=8.2
ENV GRADLE_LINK=https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-all.zip
ENV GRADLE_ROOT=/opt/gradle
ENV GRADLE_PATH=${GRADLE_ROOT}/gradle-${GRADLE_VERSION}
ENV GRADLE_BIN=$GRADLE_PATH/bin
ARG GRADLE_TEMP=/tmp/gradle.zip
ENV KTC_VERSION=1.6.21
ENV KTC_VERSION=1.8.22
ENV KTC_LINK=https://github.com/JetBrains/kotlin/releases/download/v${KTC_VERSION}/kotlin-compiler-${KTC_VERSION}.zip
ARG KTC_TEMP=/tmp/kotlinc.tgz
ENV KTC_ROOT=/opt/kotlin

View File

@ -0,0 +1,6 @@
version: '3.9'
services:
app:
image: "epicmorg/teamcity-agent:android-sdk-jdk11"
build:
context: .

View File

@ -0,0 +1,64 @@
FROM epicmorg/teamcity-agent:latest-jdk17
LABEL maintainer="EpicMorg DevTeam, developer@epicm.org"
ARG DEBIAN_FRONTEND=noninteractive
ENV ANDROID_HOME=/usr/lib/android-sdk
ENV ANDROID_SDK_ROOT=/usr/lib/android-sdk
ENV GRADLE_VERSION=8.2
ENV GRADLE_LINK=https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-all.zip
ENV GRADLE_ROOT=/opt/gradle
ENV GRADLE_PATH=${GRADLE_ROOT}/gradle-${GRADLE_VERSION}
ENV GRADLE_BIN=$GRADLE_PATH/bin
ARG GRADLE_TEMP=/tmp/gradle.zip
ENV KTC_VERSION=1.8.22
ENV KTC_LINK=https://github.com/JetBrains/kotlin/releases/download/v${KTC_VERSION}/kotlin-compiler-${KTC_VERSION}.zip
ARG KTC_TEMP=/tmp/kotlinc.tgz
ENV KTC_ROOT=/opt/kotlin
ENV KTC_PATH=${KTC_ROOT}/kotlinc
ENV KTC_BIN=$KTC_PATH/bin
ENV PATH=PATH=$PATH:$GRADLE_BIN:${KTC_BIN}
##################################################################
# Android SDK
##################################################################
RUN apt update && \
apt install -y --allow-unauthenticated \
android-sdk \
android-sdk-build-tools \
android-sdk-platform-tools-common \
android-sdk-platform-tools \
adb fastboot f2fs-tools e2fsprogs libsqlite3-0 sqlite3
# Activate android sdk
RUN echo "24333f8a63b6825ea9c5514f83c2829b004d1fee" > /usr/lib/android-sdk/licenses/android-sdk-license
##################################################################
# GRADLE
##################################################################
RUN mkdir -p $GRADLE_PATH
RUN wget --no-check-certificate -nv --random-wait --retry-connrefused --continue $GRADLE_LINK -O $GRADLE_TEMP
RUN 7zz x $GRADLE_TEMP -o$GRADLE_ROOT
RUN chmod +x -R $GRADLE_BIN
RUN gradle -v
##################################################################
# KOTLIN
##################################################################
RUN mkdir -p ${KTC_PATH}
RUN wget --no-check-certificate -nv --random-wait --retry-connrefused --continue ${KTC_LINK} -O ${KTC_TEMP}
RUN 7zz x $KTC_TEMP -o$KTC_ROOT
RUN chmod +x -R ${KTC_BIN}
RUN kotlinc -version
##################################################################
# cleaninig up
##################################################################
RUN apt clean -y && \
apt-get clean all && \
apt autoclean -y && \
rm -rfv /var/lib/apt/lists/* && \
rm -rfv /var/cache/apt/archives/*.deb && \
rm -rfv /tmp/*

View File

@ -0,0 +1,10 @@
version: '3.9'
services:
app:
image: "epicmorg/teamcity-agent:android-sdk"
build:
context: .
app-jdk17:
image: "epicmorg/teamcity-agent:android-sdk-jdk17"
build:
context: .

View File

@ -0,0 +1,312 @@
#!/bin/bash
#
# Copyright 2017 Marco Vermeulen
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# install:- channel: stable; cliVersion: 5.15.0; cliNativeVersion: NA; api: https://api.sdkman.io/2
# Global variables
SDKMAN_SERVICE="https://api.sdkman.io/2"
SDKMAN_VERSION="5.15.0"
SDKMAN_PLATFORM=$(uname)
if [ -z "$SDKMAN_DIR" ]; then
SDKMAN_DIR="$HOME/.sdkman"
SDKMAN_DIR_RAW='$HOME/.sdkman'
else
SDKMAN_DIR_RAW="$SDKMAN_DIR"
fi
# Local variables
sdkman_tmp_folder="${SDKMAN_DIR}/tmp"
sdkman_zip_file="${sdkman_tmp_folder}/sdkman-${SDKMAN_VERSION}.zip"
sdkman_zip_base_folder="${sdkman_tmp_folder}/sdkman-${SDKMAN_VERSION}"
sdkman_ext_folder="${SDKMAN_DIR}/ext"
sdkman_etc_folder="${SDKMAN_DIR}/etc"
sdkman_var_folder="${SDKMAN_DIR}/var"
sdkman_archives_folder="${SDKMAN_DIR}/archives"
sdkman_candidates_folder="${SDKMAN_DIR}/candidates"
sdkman_config_file="${sdkman_etc_folder}/config"
sdkman_bash_profile="${HOME}/.bash_profile"
sdkman_profile="${HOME}/.profile"
sdkman_bashrc="${HOME}/.bashrc"
sdkman_zshrc="${ZDOTDIR:-${HOME}}/.zshrc"
sdkman_init_snippet=$( cat << EOF
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$SDKMAN_DIR_RAW"
[[ -s "${SDKMAN_DIR_RAW}/bin/sdkman-init.sh" ]] && source "${SDKMAN_DIR_RAW}/bin/sdkman-init.sh"
EOF
)
# OS specific support (must be 'true' or 'false').
cygwin=false;
darwin=false;
solaris=false;
freebsd=false;
case "$(uname)" in
CYGWIN*)
cygwin=true
;;
Darwin*)
darwin=true
;;
SunOS*)
solaris=true
;;
FreeBSD*)
freebsd=true
esac
echo ''
echo ' -+syyyyyyys:'
echo ' `/yho:` -yd.'
echo ' `/yh/` +m.'
echo ' .oho. hy .`'
echo ' .sh/` :N` `-/o` `+dyyo:.'
echo ' .yh:` `M- `-/osysoym :hs` `-+sys: hhyssssssssy+'
echo ' .sh:` `N: ms/-`` yy.yh- -hy. `.N-````````+N.'
echo ' `od/` `N- -/oM- ddd+` `sd: hNNm -N:'
echo ' :do` .M. dMMM- `ms. /d+` `NMMs `do'
echo ' .yy- :N` ```mMMM. - -hy. /MMM: yh'
echo ' `+d+` `:/oo/` `-/osyh/ossssssdNMM` .sh: yMMN` /m.'
echo ' -dh- :ymNMMMMy `-/shmNm-`:N/-.`` `.sN /N- `NMMy .m/'
echo ' `oNs` -hysosmMMMMydmNmds+-.:ohm : sd` :MMM/ yy'
echo ' .hN+ /d: -MMMmhs/-.` .MMMh .ss+- `yy` sMMN` :N.'
echo ' :mN/ `N/ `o/-` :MMMo +MMMN- .` `ds mMMh do'
echo ' /NN/ `N+....--:/+oooosooo+:sMMM: hMMMM: `my .m+ -MMM+ :N.'
echo ' /NMo -+ooooo+/:-....`...:+hNMN. `NMMMd` .MM/ -m: oMMN. hs'
echo ' -NMd` :mm -MMMm- .s/ -MMm. /m- mMMd -N.'
echo ' `mMM/ .- /MMh. -dMo -MMMy od. .MMMs..---yh'
echo ' +MMM. sNo`.sNMM+ :MMMM/ sh`+MMMNmNm+++-'
echo ' mMMM- /--ohmMMM+ :MMMMm. `hyymmmdddo'
echo ' MMMMh. ```` `-+yy/`yMMM/ :MMMMMy -sm:.``..-:-.`'
echo ' dMMMMmo-.``````..-:/osyhddddho. `+shdh+. hMMM: :MmMMMM/ ./yy/` `:sys+/+sh/'
echo ' .dMMMMMMmdddddmmNMMMNNNNNMMMMMs sNdo- dMMM- `-/yd/MMMMm-:sy+. :hs- /N`'
echo ' `/ymNNNNNNNmmdys+/::----/dMMm: +m- mMMM+ohmo/.` sMMMMdo- .om: `sh'
echo ' `.-----+/.` `.-+hh/` `od. NMMNmds/ `mmy:` +mMy `:yy.'
echo ' /moyso+//+ossso:. .yy` `dy+:` .. :MMMN+---/oys:'
echo ' /+m: `.-:::-` /d+ +MMMMMMMNh:`'
echo ' +MN/ -yh. `+hddhy+.'
echo ' /MM+ .sh:'
echo ' :NMo -sh/'
echo ' -NMs `/yy:'
echo ' .NMy `:sh+.'
echo ' `mMm` ./yds-'
echo ' `dMMMmyo:-.````.-:oymNy:`'
echo ' +NMMMMMMMMMMMMMMMMms:`'
echo ' -+shmNMMMNmdy+:`'
echo ''
echo ''
echo ' Now attempting installation...'
echo ''
echo ''
# Sanity checks
echo "Looking for a previous installation of SDKMAN..."
if [ -d "$SDKMAN_DIR" ]; then
echo "SDKMAN found."
echo ""
echo "======================================================================================================"
echo " You already have SDKMAN installed."
echo " SDKMAN was found at:"
echo ""
echo " ${SDKMAN_DIR}"
echo ""
echo " Please consider running the following if you need to upgrade."
echo ""
echo " $ sdk selfupdate force"
echo ""
echo "======================================================================================================"
echo ""
exit 0
fi
echo "Looking for unzip..."
if ! command -v unzip > /dev/null; then
echo "Not found."
echo "======================================================================================================"
echo " Please install unzip on your system using your favourite package manager."
echo ""
echo " Restart after installing unzip."
echo "======================================================================================================"
echo ""
exit 1
fi
echo "Looking for zip..."
if ! command -v zip > /dev/null; then
echo "Not found."
echo "======================================================================================================"
echo " Please install zip on your system using your favourite package manager."
echo ""
echo " Restart after installing zip."
echo "======================================================================================================"
echo ""
exit 1
fi
echo "Looking for curl..."
if ! command -v curl > /dev/null; then
echo "Not found."
echo ""
echo "======================================================================================================"
echo " Please install curl on your system using your favourite package manager."
echo ""
echo " Restart after installing curl."
echo "======================================================================================================"
echo ""
exit 1
fi
if [[ "$solaris" == true ]]; then
echo "Looking for gsed..."
if [ -z $(which gsed) ]; then
echo "Not found."
echo ""
echo "======================================================================================================"
echo " Please install gsed on your solaris system."
echo ""
echo " SDKMAN uses gsed extensively."
echo ""
echo " Restart after installing gsed."
echo "======================================================================================================"
echo ""
exit 1
fi
else
echo "Looking for sed..."
if [ -z $(command -v sed) ]; then
echo "Not found."
echo ""
echo "======================================================================================================"
echo " Please install sed on your system using your favourite package manager."
echo ""
echo " Restart after installing sed."
echo "======================================================================================================"
echo ""
exit 1
fi
fi
echo "Installing SDKMAN scripts..."
# Create directory structure
echo "Create distribution directories..."
mkdir -p "$sdkman_tmp_folder"
mkdir -p "$sdkman_ext_folder"
mkdir -p "$sdkman_etc_folder"
mkdir -p "$sdkman_var_folder"
mkdir -p "$sdkman_archives_folder"
mkdir -p "$sdkman_candidates_folder"
echo "Getting available candidates..."
SDKMAN_CANDIDATES_CSV=$(curl -s "${SDKMAN_SERVICE}/candidates/all")
echo "$SDKMAN_CANDIDATES_CSV" > "${SDKMAN_DIR}/var/candidates"
echo "Prime the config file..."
touch "$sdkman_config_file"
echo "sdkman_auto_answer=false" >> "$sdkman_config_file"
if [ -z "$ZSH_VERSION" -a -z "$BASH_VERSION" ]; then
echo "sdkman_auto_complete=false" >> "$sdkman_config_file"
else
echo "sdkman_auto_complete=true" >> "$sdkman_config_file"
fi
echo "sdkman_auto_env=false" >> "$sdkman_config_file"
echo "sdkman_auto_update=true" >> "$sdkman_config_file"
echo "sdkman_beta_channel=false" >> "$sdkman_config_file"
echo "sdkman_checksum_enable=true" >> "$sdkman_config_file"
echo "sdkman_colour_enable=true" >> "$sdkman_config_file"
echo "sdkman_curl_connect_timeout=7" >> "$sdkman_config_file"
echo "sdkman_curl_max_time=10" >> "$sdkman_config_file"
echo "sdkman_debug_mode=false" >> "$sdkman_config_file"
echo "sdkman_insecure_ssl=false" >> "$sdkman_config_file"
echo "sdkman_rosetta2_compatible=false" >> "$sdkman_config_file"
echo "sdkman_selfupdate_feature=true" >> "$sdkman_config_file"
echo "Download script archive..."
curl --location --progress-bar "${SDKMAN_SERVICE}/broker/download/sdkman/install/${SDKMAN_VERSION}/${SDKMAN_PLATFORM}" > "$sdkman_zip_file"
ARCHIVE_OK=$(unzip -qt "$sdkman_zip_file" | grep 'No errors detected in compressed data')
if [[ -z "$ARCHIVE_OK" ]]; then
echo "Downloaded zip archive corrupt. Are you connected to the internet?"
echo ""
echo "If problems persist, please ask for help on our Slack:"
echo "* easy sign up: https://slack.sdkman.io/"
echo "* report on channel: https://sdkman.slack.com/app_redirect?channel=user-issues"
rm -rf "$SDKMAN_DIR"
exit 1
fi
echo "Extract script archive..."
if [[ "$cygwin" == 'true' ]]; then
echo "Cygwin detected - normalizing paths for unzip..."
sdkman_tmp_folder=$(cygpath -w "$sdkman_tmp_folder")
sdkman_zip_file=$(cygpath -w "$sdkman_zip_file")
sdkman_zip_base_folder=$(cygpath -w "$sdkman_zip_base_folder")
fi
unzip -qo "$sdkman_zip_file" -d "$sdkman_tmp_folder"
echo "Install scripts..."
mv "${sdkman_zip_base_folder}/"* "$SDKMAN_DIR"
rm -rf "$sdkman_zip_base_folder"
echo "Set version to $SDKMAN_VERSION ..."
echo "$SDKMAN_VERSION" > "${SDKMAN_DIR}/var/version"
if [[ $darwin == true ]]; then
touch "$sdkman_bash_profile"
echo "Attempt update of login bash profile on OSX..."
if [[ -z $(grep 'sdkman-init.sh' "$sdkman_bash_profile") ]]; then
echo -e "\n$sdkman_init_snippet" >> "$sdkman_bash_profile"
echo "Added sdkman init snippet to $sdkman_bash_profile"
fi
else
echo "Attempt update of interactive bash profile on regular UNIX..."
touch "${sdkman_bashrc}"
if [[ -z $(grep 'sdkman-init.sh' "$sdkman_bashrc") ]]; then
echo -e "\n$sdkman_init_snippet" >> "$sdkman_bashrc"
echo "Added sdkman init snippet to $sdkman_bashrc"
fi
fi
echo "Attempt update of zsh profile..."
touch "$sdkman_zshrc"
if [[ -z $(grep 'sdkman-init.sh' "$sdkman_zshrc") ]]; then
echo -e "\n$sdkman_init_snippet" >> "$sdkman_zshrc"
echo "Updated existing ${sdkman_zshrc}"
fi
echo -e "\n\n\nAll done!\n\n"
echo "You are subscribed to the STABLE channel."
echo ""
echo "Please open a new terminal, or run the following in the existing one:"
echo ""
echo " source \"${SDKMAN_DIR}/bin/sdkman-init.sh\""
echo ""
echo "Then issue the following command:"
echo ""
echo " sdk help"
echo ""
echo "Enjoy!!!"

View File

@ -0,0 +1,19 @@
all: app
app:
make build
make deploy
make clean
build:
docker-compose build --compress --parallel --progress plain
deploy:
docker-compose push
clean:
docker container prune -f
docker image prune -f
docker network prune -f
docker volume prune -f
docker system prune -af

View File

@ -0,0 +1,93 @@
## TeamCity Minimal Build Agent
[<img src="http://jb.gg/badges/official.svg" height="20"/>](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
This is an official [JetBrains TeamCity](https://www.jetbrains.com/teamcity/) minimal build agent image.
<img src="https://raw.githubusercontent.com/JetBrains/teamcity-docker-images/master/logo/GitHub.png" height="20" align="center"/> More details about tags and components are [here](https://github.com/JetBrains/teamcity-docker-images/blob/master/generated/teamcity-minimal-agent.md).
The [TeamCity build agent](https://www.jetbrains.com/help/teamcity/build-agent.html) connects to the TeamCity server and spawns the actual build processes.
You can use the ```jetbrains/teamcity-server``` image to run a TeamCity server.
This minimal image adds just a TeamCity agent without any tools like VCS clients, etc. It is suitable for simple builds and can serve as a base for your custom images. For Java or .NET development we recommend using the default build agent image [jetbrains/teamcity-agent](https://hub.docker.com/r/jetbrains/teamcity-agent/).
## How to Use This Image
Pull the TeamCity minimal image from the Docker Hub Repository:
```
jetbrains/teamcity-minimal-agent
```
&nbsp;
and use the following command to start a container with TeamCity agent running inside
a Linux container:
```
docker run -it -e SERVER_URL="<url to TeamCity server>" \
-v <path to agent config folder>:/data/teamcity_agent/conf \
jetbrains/teamcity-minimal-agent
```
&nbsp;
or a Windows container:
```
docker run -it -e SERVER_URL="<url to TeamCity server>"
-v <path to agent config folder>:C:/BuildAgent/conf
jetbrains/teamcity-minimal-agent
```
where `<url to TeamCity server>` is the full URL for TeamCity server, accessible by the agent. Note that `localhost` will not generally not work as it will refer to the `localhost` inside the container.
`<path to agent config folder>` is the host machine directory to serve as the TeamCity agent config directory. We recommend providing this binding in order to persist the agent configuration, e.g. authorization on the server. Note that you should map a different folder for every new agent you create.
Since version 2020.1, TeamCity agent Docker images __run under a non-root user__. Refer to our [upgrade notes](https://www.jetbrains.com/help/teamcity/upgrade-notes.html#UpgradeNotes-AgentDockerimagesrunundernon-rootuser) for information on possible affected use cases.
When you run the agent for the first time, you should authorize it via the TeamCity server UI: go to the **Unauthorized Agents** page in your browser. See [more details](https://www.jetbrains.com/help/teamcity/build-agent.html).
All information about agent authorization is stored in agent's configuration folder. If you stop the container with the agent and then start a new one with the same config folder, the agent's name and authorization state will be preserved.
TeamCity agent does not need manual upgrade: it will upgrade itself automatically on connecting to an upgraded server.
### Agent Image Environment Variables
- **SERVER_URL** - URL of the TeamCity server agent will connect to
- **AGENT_NAME** - (optional) Name of the agent in TeamCity UI, autogenerated if omitted
- **AGENT_TOKEN** - (optional) Agent authorization token, if unset, the agent should be [authorized](https://www.jetbrains.com/help/teamcity/build-agent.html#BuildAgent-BuildAgentStatus) via TeamCity UI.
- **OWN_ADDRESS** - (optional, linux only) IP address build agent binds to, autodetected
- **OWN_PORT** - (optional, linux only) Port build agent binds to, 9090 by default
### Windows Containers Limitations
The details on the known problems in Windows containers are available in the [TeamCity documentation](https://www.jetbrains.com/help/teamcity/known-issues.html#KnownIssues-WindowsDockerContainers).
## Customization
You can customize the image via the usual Docker procedure:
1. Run the image
```
docker run -it -e SERVER_URL="<url to TeamCity server>" \
-v <path to agent config folder>:/data/teamcity_agent/conf \
--name="my-customized-agent" \
jetbrains/teamcity-minimal-agent \
```
2. Enter the container
```
docker exec -it my-customized-agent bash
```
3. Change whatever you need
4. Exit and [create a new image](https://docs.docker.com/engine/reference/commandline/commit/) from the container
```
docker commit my-customized-agent <the registry where you what to store the image>
```
## License
The image is available under the [TeamCity license](https://www.jetbrains.com/teamcity/buy/license.html).
TeamCity is free for perpetual use with the limitation of 100 build configurations (jobs) and 3 agents. [Licensing details](https://www.jetbrains.com/help/teamcity/licensing-policy.html).
## Feedback
Report issues of suggestions to the official TeamCity [issue tracker](https://youtrack.jetbrains.com/issues/TW).
## Other TeamCity Images
* [TeamCity Server](https://hub.docker.com/r/jetbrains/teamcity-server/)
* [Build Agent](https://hub.docker.com/r/jetbrains/teamcity-agent/)

View File

@ -1,6 +1,6 @@
version: '3.9'
services:
app:
image: "epicmorg/teamcity-agent:android-sdk"
image: "epicmorg/teamcity-agent:latest-jdk11"
build:
context: .

View File

@ -0,0 +1,90 @@
FROM epicmorg/debian:bullseye-develop-jdk11
LABEL maintainer="EpicMorg DevTeam, developer@epicm.org"
ARG DEBIAN_FRONTEND=noninteractive
##################################################################
# sid sources list
##################################################################
#RUN rm -rfv /etc/apt/sources.list
#COPY sources.sid.list /etc/apt/sources.list
RUN apt update && \
apt autoremove -y && \
apt dist-upgrade -y && \
apt autoremove -y
##################################################################
# teamcity minimal agent
##################################################################
LABEL dockerImage.teamcity.version="latest" \
dockerImage.teamcity.buildNumber="latest"
VOLUME /data/teamcity_agent/conf
ENV CONFIG_FILE=/data/teamcity_agent/conf/buildAgent.properties
ENV LANG=C.UTF-8
ENV GIT_SSH_VARIANT=ssh
COPY run-agent.sh /run-agent.sh
RUN chmod +x /run-agent.sh && \
sync
COPY run-services.sh /run-services.sh
RUN chmod +x /run-services.sh && \
sync
ADD https://teamcity.jetbrains.com/update/buildAgent.zip /buildAgent.zip
RUN unzip -q /buildAgent.zip -d /opt/buildagent && \
mv /opt/buildagent/conf /opt/buildagent/conf_dist && \
rm -rfv /buildAgent.zip
RUN useradd -m buildagent && \
chmod +x /opt/buildagent/bin/*.sh && \
chmod +x /run-agent.sh /run-services.sh && sync
##################################################################
# teamcity docker setup
##################################################################
#Install packages
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - && \
echo 'deb https://download.docker.com/linux/debian bullseye test' > /etc/apt/sources.list.d/docker.list && \
echo 'deb https://download.docker.com/linux/debian bullseye nightly' >> /etc/apt/sources.list.d/docker.list && \
apt-cache policy docker-ce && \
apt-get update && \
apt-get install -y --no-install-recommends --allow-unauthenticated \
docker-ce \
docker-ce-cli \
containerd.io systemd && \
systemctl disable docker && \
usermod -aG docker buildagent
# A better fix for TW-52939 Dockerfile build fails because of aufs
VOLUME /var/lib/docker
COPY run-docker.sh /services/run-docker.sh
RUN chmod +x /services/run-docker.sh && \
sync
##################################################################
# teamcity docker compose setup
##################################################################
#Install packages
RUN export DOCKER_COMPOSE_VERSION=`curl --silent https://api.github.com/repos/docker/compose/releases/latest | jq .name -r` && \
echo "Latest compose is: ${DOCKER_COMPOSE_VERSION}" && \
curl -SL https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Linux-x86_64 -o /usr/local/bin/docker-compose && \
chmod +x /usr/local/bin/docker-compose
##################################################################
# cleaninig up
##################################################################
RUN apt clean -y && \
apt-get clean all && \
apt autoclean -y && \
rm -rfv /var/lib/apt/lists/* && \
rm -rfv /var/cache/apt/archives/*.deb && \
rm -rfv /tmp/*
CMD ["/run-services.sh"]
EXPOSE 9090

View File

@ -0,0 +1,19 @@
all: app
app:
make build
make deploy
make clean
build:
docker-compose build --compress --parallel --progress plain
deploy:
docker-compose push
clean:
docker container prune -f
docker image prune -f
docker network prune -f
docker volume prune -f
docker system prune -af

View File

@ -0,0 +1,93 @@
## TeamCity Minimal Build Agent
[<img src="http://jb.gg/badges/official.svg" height="20"/>](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
This is an official [JetBrains TeamCity](https://www.jetbrains.com/teamcity/) minimal build agent image.
<img src="https://raw.githubusercontent.com/JetBrains/teamcity-docker-images/master/logo/GitHub.png" height="20" align="center"/> More details about tags and components are [here](https://github.com/JetBrains/teamcity-docker-images/blob/master/generated/teamcity-minimal-agent.md).
The [TeamCity build agent](https://www.jetbrains.com/help/teamcity/build-agent.html) connects to the TeamCity server and spawns the actual build processes.
You can use the ```jetbrains/teamcity-server``` image to run a TeamCity server.
This minimal image adds just a TeamCity agent without any tools like VCS clients, etc. It is suitable for simple builds and can serve as a base for your custom images. For Java or .NET development we recommend using the default build agent image [jetbrains/teamcity-agent](https://hub.docker.com/r/jetbrains/teamcity-agent/).
## How to Use This Image
Pull the TeamCity minimal image from the Docker Hub Repository:
```
jetbrains/teamcity-minimal-agent
```
&nbsp;
and use the following command to start a container with TeamCity agent running inside
a Linux container:
```
docker run -it -e SERVER_URL="<url to TeamCity server>" \
-v <path to agent config folder>:/data/teamcity_agent/conf \
jetbrains/teamcity-minimal-agent
```
&nbsp;
or a Windows container:
```
docker run -it -e SERVER_URL="<url to TeamCity server>"
-v <path to agent config folder>:C:/BuildAgent/conf
jetbrains/teamcity-minimal-agent
```
where `<url to TeamCity server>` is the full URL for TeamCity server, accessible by the agent. Note that `localhost` will not generally not work as it will refer to the `localhost` inside the container.
`<path to agent config folder>` is the host machine directory to serve as the TeamCity agent config directory. We recommend providing this binding in order to persist the agent configuration, e.g. authorization on the server. Note that you should map a different folder for every new agent you create.
Since version 2020.1, TeamCity agent Docker images __run under a non-root user__. Refer to our [upgrade notes](https://www.jetbrains.com/help/teamcity/upgrade-notes.html#UpgradeNotes-AgentDockerimagesrunundernon-rootuser) for information on possible affected use cases.
When you run the agent for the first time, you should authorize it via the TeamCity server UI: go to the **Unauthorized Agents** page in your browser. See [more details](https://www.jetbrains.com/help/teamcity/build-agent.html).
All information about agent authorization is stored in agent's configuration folder. If you stop the container with the agent and then start a new one with the same config folder, the agent's name and authorization state will be preserved.
TeamCity agent does not need manual upgrade: it will upgrade itself automatically on connecting to an upgraded server.
### Agent Image Environment Variables
- **SERVER_URL** - URL of the TeamCity server agent will connect to
- **AGENT_NAME** - (optional) Name of the agent in TeamCity UI, autogenerated if omitted
- **AGENT_TOKEN** - (optional) Agent authorization token, if unset, the agent should be [authorized](https://www.jetbrains.com/help/teamcity/build-agent.html#BuildAgent-BuildAgentStatus) via TeamCity UI.
- **OWN_ADDRESS** - (optional, linux only) IP address build agent binds to, autodetected
- **OWN_PORT** - (optional, linux only) Port build agent binds to, 9090 by default
### Windows Containers Limitations
The details on the known problems in Windows containers are available in the [TeamCity documentation](https://www.jetbrains.com/help/teamcity/known-issues.html#KnownIssues-WindowsDockerContainers).
## Customization
You can customize the image via the usual Docker procedure:
1. Run the image
```
docker run -it -e SERVER_URL="<url to TeamCity server>" \
-v <path to agent config folder>:/data/teamcity_agent/conf \
--name="my-customized-agent" \
jetbrains/teamcity-minimal-agent \
```
2. Enter the container
```
docker exec -it my-customized-agent bash
```
3. Change whatever you need
4. Exit and [create a new image](https://docs.docker.com/engine/reference/commandline/commit/) from the container
```
docker commit my-customized-agent <the registry where you what to store the image>
```
## License
The image is available under the [TeamCity license](https://www.jetbrains.com/teamcity/buy/license.html).
TeamCity is free for perpetual use with the limitation of 100 build configurations (jobs) and 3 agents. [Licensing details](https://www.jetbrains.com/help/teamcity/licensing-policy.html).
## Feedback
Report issues of suggestions to the official TeamCity [issue tracker](https://youtrack.jetbrains.com/issues/TW).
## Other TeamCity Images
* [TeamCity Server](https://hub.docker.com/r/jetbrains/teamcity-server/)
* [Build Agent](https://hub.docker.com/r/jetbrains/teamcity-agent/)

View File

@ -4,3 +4,7 @@ services:
image: "epicmorg/teamcity-agent:latest"
build:
context: .
app-jdk17:
image: "epicmorg/teamcity-agent:latest-jdk17"
build:
context: .

View File

@ -0,0 +1,90 @@
#!/bin/bash
check() {
if [[ $? != 0 ]]; then
echo "Error! Stopping the script."
exit 1
fi
}
configure() {
if [[ $# -gt 0 ]]; then
echo "run agent.sh configure $@"
${AGENT_DIST}/bin/agent.sh configure "$@"; check
fi
}
reconfigure() {
declare -a opts
[[ -n "${SERVER_URL}" ]] && opts[${#opts[@]}]='--server-url' && opts[${#opts[@]}]="$SERVER_URL"
[[ -n "${AGENT_TOKEN}" ]] && opts[${#opts[@]}]='--auth-token' && opts[${#opts[@]}]="$AGENT_TOKEN"
[[ -n "${AGENT_NAME}" ]] && opts[${#opts[@]}]='--name' && opts[${#opts[@]}]="$AGENT_NAME"
[[ -n "${OWN_ADDRESS}" ]] && opts[${#opts[@]}]='--ownAddress' && opts[${#opts[@]}]="$OWN_ADDRESS"
[[ -n "${OWN_PORT}" ]] && opts[${#opts[@]}]='--ownPort' && opts[${#opts[@]}]="$OWN_PORT"
if [[ 0 -ne "${#opts[@]}" ]]; then
# Using sed to strip double quotes produced by docker-compose
for i in $(seq 0 $(expr ${#opts[@]} - 1)); do
opts[$i]="$(echo "${opts[$i]}" | sed -e 's/""/"/g')"
done
configure "${opts[@]}"
echo "File buildAgent.properties was updated"
fi
for AGENT_OPT in ${AGENT_OPTS}; do
echo ${AGENT_OPT} >> ${CONFIG_DIR}/buildAgent.properties
done
}
prepare_conf() {
echo "Will prepare agent config" ;
cp -p ${AGENT_DIST}/conf_dist/*.* ${CONFIG_DIR}/; check
cp -p ${CONFIG_DIR}/buildAgent.dist.properties ${CONFIG_DIR}/buildAgent.properties; check
reconfigure
echo "File buildAgent.properties was created and updated" ;
}
AGENT_DIST=/opt/buildagent
CONFIG_DIR=/data/teamcity_agent/conf
LOG_DIR=/opt/buildagent/logs
rm -f ${LOG_DIR}/*.pid
if [ -f ${CONFIG_DIR}/buildAgent.properties ] ; then
echo "File buildAgent.properties was found in ${CONFIG_DIR}" ;
reconfigure
else
echo "Will create new buildAgent.properties using distributive" ;
if [[ -n "${SERVER_URL}" ]]; then
echo "TeamCity URL is provided: ${SERVER_URL}"
else
echo "TeamCity URL is not provided, but is required."
exit 1
fi
prepare_conf
fi
if [ -z "$RUN_AS_BUILDAGENT" -o "$RUN_AS_BUILDAGENT" = "false" -o "$RUN_AS_BUILDAGENT" = "no" ]; then
${AGENT_DIST}/bin/agent.sh start
else
echo "Make sure build agent directory ${AGENT_DIST} is owned by buildagent user"
chown -R buildagent:buildagent ${AGENT_DIST}
check; sync
echo "Start build agent under buildagent user"
sudo -E -u buildagent HOME=/home/buildagent ${AGENT_DIST}/bin/agent.sh start
fi
while [ ! -f ${LOG_DIR}/teamcity-agent.log ];
do
echo -n "."
sleep 1
done
trap '${AGENT_DIST}/bin/agent.sh stop force; while ps -p $(cat $(ls -1 ${LOG_DIR}/*.pid)) &>/dev/null; do sleep 1; done; kill %%' SIGINT SIGTERM SIGHUP
tail -qF ${LOG_DIR}/teamcity-agent.log &
wait

View File

@ -0,0 +1,7 @@
#!/bin/bash
if [ "$DOCKER_IN_DOCKER" = "start" ] ; then
rm /var/run/docker.pid 2>/dev/null
service docker start
echo "Docker daemon started"
fi

View File

@ -0,0 +1,15 @@
#!/bin/bash
echo '/run-services.sh'
for entry in /services/*.sh
do
if [[ -f "$entry" ]]; then
echo "$entry"
[[ ! -x "$entry" ]] && (chmod +x "$entry"; sync)
"$entry"
fi
done
echo '/run-agent.sh'
exec '/run-agent.sh'

View File

@ -0,0 +1,7 @@
#main
deb http://httpredir.debian.org/debian/ sid main contrib non-free
deb-src http://httpredir.debian.org/debian/ sid main contrib non-free
##multimedia
#deb http://httpredir.debian.org/debian-multimedia/ sid main non-free
#deb-src http://httpredir.debian.org/debian-multimedia/ sid main non-free