Skip to content

Commit

Permalink
goreleaser: add a release docker image (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicks authored Mar 16, 2021
1 parent 4bbedc1 commit 5e5cbbc
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .circleci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# Builds a Docker image with:
# - ctlptl
# - docker
# - kubectl
# - kind
# - socat
# - golang build toolchain
#
# Similar to the release image (which contains everything BUT the build
# toolchain)

FROM golang:1.14-buster

RUN apt update
RUN apt install -y curl ca-certificates liblz4-tool rsync socat
RUN apt update && apt install -y curl ca-certificates liblz4-tool rsync socat

# Install docker
# Adapted from https://github.com/circleci/circleci-images/blob/staging/shared/images/Dockerfile-basic.template
Expand Down
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ jobs:
- image: circleci/golang:1.14
steps:
- checkout
- setup_remote_docker:
version: 19.03.12
- run: git fetch --tags
- run: curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
- run: sudo mv ./bin/goreleaser /usr/local/bin/
Expand All @@ -74,9 +76,12 @@ jobs:
- image: circleci/golang:1.14
steps:
- checkout
- setup_remote_docker:
version: 19.03.12
- run: git fetch --tags
- run: curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
- run: sudo mv ./bin/goreleaser /usr/local/bin/
- run: echo "$DOCKER_TOKEN" | docker login --username "$DOCKER_USERNAME" --password-stdin
- run: goreleaser --rm-dist
- slack/status:
mentions: "nick"
Expand All @@ -100,6 +105,7 @@ workflows:
- release:
context:
- Tilt Release CLI Context
- Tilt Docker Login Context
filters:
branches:
only: never-release-on-a-branch
Expand Down
5 changes: 5 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ scoop:
homepage: "https://ctlptl.dev/"
description: "Making local Kubernetes clusters easy to set up and tear down"
license: Apache-2.0
dockers:
- image_templates:
- "tiltdev/ctlptl"
- "tiltdev/ctlptl:{{ .Tag }}"
dockerfile: hack/Dockerfile

# Uncomment these lines if you want to experiment with other
# parts of the release process without releasing new binaries.
Expand Down
46 changes: 46 additions & 0 deletions hack/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Builds a Docker image with:
# - ctlptl
# - docker
# - kubectl
# - kind
# - socat
#
# Good base image for anyone that wants to use ctlptl in a CI environment
# to set up a one-time-use cluster.
#
# Built with goreleaser.

FROM debian:buster

RUN apt update && apt install -y curl ca-certificates liblz4-tool rsync socat

# Install docker
# Adapted from https://github.com/circleci/circleci-images/blob/staging/shared/images/Dockerfile-basic.template
# Check https://download.docker.com/linux/static/stable/x86_64/ for latest versions
ENV DOCKER_VERSION=19.03.5
RUN set -exu \
&& DOCKER_URL="https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz" \
&& echo Docker URL: $DOCKER_URL \
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/docker.tgz "${DOCKER_URL}" \
&& ls -lha /tmp/docker.tgz \
&& tar -xz -C /tmp -f /tmp/docker.tgz \
&& mv /tmp/docker/* /usr/bin \
&& rm -rf /tmp/docker /tmp/docker.tgz \
&& which docker \
&& (docker version || true)

# Install kubectl client
RUN apt install -y apt-transport-https gnupg \
&& curl -fsS https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
&& touch /etc/apt/sources.list.d/kubernetes.list \
&& echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list \
&& apt update && apt install -y kubectl

# install Kind
ENV KIND_VERSION=v0.10.0
RUN set -exu \
&& curl -fLo ./kind-linux-amd64 "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64" \
&& chmod +x ./kind-linux-amd64 \
&& mv ./kind-linux-amd64 /usr/local/bin/kind

COPY ctlptl /usr/local/bin/ctlptl

0 comments on commit 5e5cbbc

Please sign in to comment.