Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Breaking the image up into a base image with a few other examples
Browse files Browse the repository at this point in the history
  • Loading branch information
BobJWalker committed Oct 2, 2020
1 parent abf4918 commit ce170a0
Show file tree
Hide file tree
Showing 12 changed files with 414 additions and 152 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/dockerhubpush.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Docker-push

on:
push:
# Publish `v1.2.3` tags as releases.
tags:
- v*
env:
BASE_IMAGE_NAME: octopuslabs/tentacle
WORKER_IMAGE_NAME: octopuslabs/tentacle-worker
EXECUTION_CONTAINER_IMAGE_NAME: octopuslabs/tentacle-executioncontainer
K8S_IMAGE_NAME: octopuslabs/tentacle-k8sworker

jobs:
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
name: Build and Push Docker Image

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Build base image
run: docker build ./base --tag $BASE_IMAGE_NAME

- name: Log into DockerHub
# TODO: Create a PAT with `read:packages` and `write:packages` scopes and save it as an Actions secret `CR_PAT`
run: echo "${{ secrets.CR_PAT }}" | docker login -u devopsatoctopus --password-stdin

- name: Push base image to DockerHub
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
echo VERSION=$VERSION
docker tag $BASE_IMAGE_NAME $BASE_IMAGE_NAME:latest
docker tag $BASE_IMAGE_NAME $BASE_IMAGE_NAME:$VERSION
docker push $BASE_IMAGE_NAME:$VERSION
docker push $BASE_IMAGE_NAME:latest
- name: Build worker image
run: docker build ./tentacle-worker --tag $WORKER_IMAGE_NAME

- name: Push worker image to DockerHub
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
echo VERSION=$VERSION
docker tag $WORKER_IMAGE_NAME $WORKER_IMAGE_NAME:latest
docker tag $WORKER_IMAGE_NAME $WORKER_IMAGE_NAME:$VERSION
docker push $WORKER_IMAGE_NAME:$VERSION
docker push $WORKER_IMAGE_NAME:latest
- name: Build execution container image
run: docker build ./tentacle-executioncontainer --tag $EXECUTION_CONTAINER_IMAGE_NAME

- name: Push execution container image to DockerHub
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
echo VERSION=$VERSION
docker tag $EXECUTION_CONTAINER_IMAGE_NAME $EXECUTION_CONTAINER_IMAGE_NAME:latest
docker tag $EXECUTION_CONTAINER_IMAGE_NAME $EXECUTION_CONTAINER_IMAGE_NAME:$VERSION
docker push $EXECUTION_CONTAINER_IMAGE_NAME:$VERSION
docker push $EXECUTION_CONTAINER_IMAGE_NAME:latest
- name: Build k8s image
run: docker build ./tentacle-executioncontainer --tag $K8S_IMAGE_NAME

- name: Push k8s image to DockerHub
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
echo VERSION=$VERSION
docker tag $K8S_IMAGE_NAME $K8S_IMAGE_NAME:latest
docker tag $K8S_IMAGE_NAME $K8S_IMAGE_NAME:$VERSION
docker push $K8S_IMAGE_NAME:$VERSION
docker push $K8S_IMAGE_NAME:latest
43 changes: 0 additions & 43 deletions .github/workflows/dockerpush.yml

This file was deleted.

61 changes: 55 additions & 6 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,73 @@
# Docker Linux Tentacle
This is a sample Linux-based Docker image that houses a tentacle for [Octopus Deploy](https://octopus.com).
This repository contains the docker files to build a sample Linux-based Docker image that houses a tentacle for [Octopus Deploy](https://octopus.com).

# This docker image is provided as is
This docker image was created by the Octopus Advisory Team as an example for our users so they could build their own docker images. It is used internally and it should work for 99% of your use cases, it is not officially supported. Please do not contact support if you run into issues with this image.
This docker image was created by the Octopus Advisory Team as an example for our users so they could build their own docker images. It is used internally and it should work for 99% of your use cases, it is not officially supported. Please do not contact support if you run into issues with this image.

# What's in the box
The docker image includes tooling to make it easy to get going right from the start.
# Images
There are four images to help get you started.

## Tentacle
This is the bare bones to run a tentacle as a docker container. It is based on the latest .NET Core runtime dependencies `3.1-bionic` image provided by Microsoft.

It includes the following software:

- wget
- unzip
- apt-utils
- curl
- software-properties-common

If you are going to create a custom image, this is the one to create it from.

## Tentacle-Worker
Built on top of the tentacle image. It includes useful software so it can be used as a worker. It includes all the software from the tentacle image plus:

- PowerShell Core
- Octopus Client
- Octopus Deploy CLI
- .NET Core 3.1.x
- python
- groff
- az modules
- azure cli
- jdk
- maven
- gradle
- gcp cli
- aws cli
- eks cli
- ecs cli
- aws IAM authenticator
- openssh-client
- git
- Docker
- kubectl
- terraform
- nodejs
- helm
- istio
- linkerd
- skopeo

## Tentacle-K8sWorker
Built on top of the tentacle image. Unlike the tentacle-worker, this only includes the software necessary for kubernetes deployments.

- az modules
- azure cli
- gcp cli
- aws cli
- eks cli
- ecs cli
- aws IAM authenticator
- openssh-client
- git
- kubectl
- helm
- istio
- linkerd
- skopeo

## Tentacle-ExecutionContainer
Built on top of the tentacle image. It includes all the software from the base tentacle image plus the necessary software to use the [execution container feature](https://octopus.com/docs/deployment-process/execution-containers-for-workers) in Octopus Deploy.

# Docker Image information
The docker container has a few self-imposed limitations.
Expand Down
35 changes: 35 additions & 0 deletions base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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

EXPOSE 10933

COPY ./scripts/* /scripts/
RUN chmod +x /scripts/*.sh

# 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 /

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 DISABLE_DIND=N
ENV ACCEPT_EULA=N

CMD /scripts/configure-tentacle.sh && /scripts/run-tentacle.sh
File renamed without changes.
File renamed without changes.
103 changes: 0 additions & 103 deletions docker/Dockerfile

This file was deleted.

17 changes: 17 additions & 0 deletions tentacle-executioncontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM octopuslabs/tentacle:latest

RUN apt-get update && \
apt-get install -y curl sudo dos2unix && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /tmp

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
Loading

0 comments on commit ce170a0

Please sign in to comment.