This repository has been archived by the owner on Sep 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating the base docker image to not have the docker in docker featu…
…re enabled
- Loading branch information
1 parent
cb5ae0b
commit e23a036
Showing
6 changed files
with
104 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,4 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
if [[ "$DISABLE_DIND" == "Y" ]]; then | ||
echo Docker-in-Docker is disabled. | ||
else | ||
echo "Starting Docker-in-Docker daemon. This requires that this container be run in privileged mode." | ||
nohup /usr/local/bin/dockerd-entrypoint.sh dockerd & | ||
fi | ||
|
||
tentacle agent --instance Tentacle --noninteractive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,54 @@ | ||
FROM octopuslabs/tentacle:latest | ||
FROM mcr.microsoft.com/dotnet/core/runtime-deps:3.1-bionic | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y wget unzip apt-utils curl software-properties-common | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y curl sudo dos2unix && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
EXPOSE 10933 | ||
|
||
WORKDIR /tmp | ||
|
||
COPY ./scripts/* /scripts/ | ||
RUN chmod +x /scripts/*.sh | ||
|
||
COPY ./install-scripts/* /install-scripts/ | ||
RUN chmod +x /install-scripts/*.sh | ||
|
||
# Install Docker daemon and CLI | ||
COPY ./scripts/dockerd-entrypoint.sh /usr/local/bin/ | ||
RUN /install-scripts/install-docker.sh | ||
|
||
VOLUME /var/lib/docker | ||
# Install Tentacle | ||
RUN apt-key adv --fetch-keys https://apt.octopus.com/public.key && \ | ||
add-apt-repository "deb https://apt.octopus.com/ stretch main" && \ | ||
apt-get update && \ | ||
apt-get install tentacle | ||
|
||
WORKDIR / | ||
|
||
# We know this won't reduce the image size at all. It's just to make the filesystem a little tidier. | ||
RUN rm -rf /tmp/* | ||
|
||
ENV DISABLE_DIND=N | ||
ENV SERVER_URL="https://octopus.example.com/" | ||
ENV SERVER_PORT=10943 | ||
ENV SERVER_API_KEY="API-SOURCE-THIS-FROM-YOUR-OCTOPUS-SERVER" | ||
ENV ServerThumbprint="" | ||
ENV SERVER_USERNAME="" | ||
ENV SERVER_PASSWORD="" | ||
ENV TARGET_ENVIRONMENT="" | ||
ENV TARGET_ROLE="" | ||
ENV REGISTRATION_NAME="" | ||
ENV SPACE="Default" | ||
ENV TARGET_WORKER_POOL="" | ||
ENV MACHINE_POLICY_NAME="Default Machine Policy" | ||
ENV COMMUNICATION_TYPE="Polling" | ||
ENV ACCEPT_EULA=N | ||
|
||
VOLUME /var/lib/docker | ||
|
||
CMD /scripts/configure-tentacle.sh && /scripts/run-tentacle.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
function splitAndGetArgs { | ||
finalstring="" | ||
IFS=',' | ||
#Convert string to array | ||
read -ra strarr <<< "$2" | ||
for i in "${strarr[@]}"; do | ||
finalstring+="--$1 \"$(echo $i | xargs)\" " | ||
done | ||
echo $finalstring | ||
} | ||
|
||
if [[ "$ACCEPT_EULA" != "Y" ]]; then | ||
echo "ERROR: You must accept the EULA at https://octopus.com/company/legal by passing an environment variable 'ACCEPT_EULA=Y'" | ||
exit 1 | ||
fi | ||
|
||
if [ -f "/usr/bin/tentacle" ]; then | ||
echo "Octopus Tentacle is already configured." | ||
return | ||
fi | ||
|
||
ln -s /opt/octopus/tentacle/Tentacle /usr/bin/tentacle | ||
|
||
# Tentacle Docker images only support once instance per container. Running multiple instances can be achieved by running multiple containers. | ||
instanceName=Tentacle | ||
configurationDirectory=/etc/octopus | ||
applicationsDirectory=/home/Octopus/Applications | ||
|
||
mkdir -p $configurationDirectory | ||
mkdir -p $applicationsDirectory | ||
|
||
tentacle create-instance --instance "$instanceName" --config "$configurationDirectory/tentacle.config" | ||
tentacle new-certificate --instance "$instanceName" --if-blank | ||
|
||
registerName=$HOSTNAME | ||
if [[ "$REGISTRATION_NAME" != "" ]]; then | ||
registerName=$REGISTRATION_NAME | ||
fi | ||
|
||
workerPoolString=$(splitAndGetArgs "workerpool" "$TARGET_WORKER_POOL") | ||
|
||
if [[ "$COMMUNICATION_TYPE" != "Polling" ]]; then | ||
tentacle configure --instance "$instanceName" --app "$applicationsDirectory" --noListen "False" --reset-trust --port "$LISTENING_PORT" | ||
tentacle configure --trust "$ServerThumbprint" | ||
eval tentacle register-worker --instance \"$instanceName\" --server \"$SERVER_URL\" --name \"$registerName\" --comms-style \"TentaclePassive\" --tentacle-comms-port $LISTENING_PORT --username \"$SERVER_USERNAME\" --password \"$SERVER_PASSWORD\" --apiKey \"$SERVER_API_KEY\" --space \"$SPACE\" --policy=\"$MACHINE_POLICY_NAME\" $workerPoolString --force | ||
else | ||
tentacle configure --instance "$instanceName" --app "$applicationsDirectory" --noListen "True" --reset-trust | ||
eval tentacle register-worker --instance \"$instanceName\" --server \"$SERVER_URL\" --name \"$registerName\" --comms-style \"TentacleActive\" --server-comms-port $SERVER_PORT --username \"$SERVER_USERNAME\" --password \"$SERVER_PASSWORD\" --apiKey \"$SERVER_API_KEY\" --space \"$SPACE\" --policy=\"$MACHINE_POLICY_NAME\" $workerPoolString --force | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
if [[ "$DISABLE_DIND" == "Y" ]]; then | ||
echo Docker-in-Docker is disabled. | ||
else | ||
echo "Starting Docker-in-Docker daemon. This requires that this container be run in privileged mode." | ||
nohup /usr/local/bin/dockerd-entrypoint.sh dockerd & | ||
fi | ||
|
||
tentacle agent --instance Tentacle --noninteractive |