Skip to content

Instantly share code, notes, and snippets.

@eiximenis
Created March 13, 2020 11:46
Show Gist options
  • Save eiximenis/dc79ebde69ad6015f78836ef1748a186 to your computer and use it in GitHub Desktop.
Save eiximenis/dc79ebde69ad6015f78836ef1748a186 to your computer and use it in GitHub Desktop.
Dockerfile & Compose file to run operator-sdk on Windows environments (where is not supported) using a container
version: '3.4'
services:
operator-sdk:
image: operator-sdk:${RELEASE_VERSION:-v0.15.2}
build:
context: .
args:
RELEASE_VERSION: ${RELEASE_VERSION:-v0.15.2}
container_name: operator-sdk
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ${SOURCE:-.}:/src
- ${userprofile}\.kube:/root/.kube
- package-cache:/go/pkg
volumes:
package-cache: {}
ARG RELEASE_VERSION=v0.15.2
FROM golang:1.14.0-buster
ARG RELEASE_VERSION
ENV GOROOT=/usr/local/go
# Download and install operator sdk
WORKDIR /usr/local/bin
RUN curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && \
chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && \
ln -s operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu operator-sdk
# Download and install Docker CLI (no daemon)
RUN apt-get update && apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y && \
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - && \
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian buster stable" && \
apt-get update && apt-get install docker-ce-cli -y
# Download kubectl
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl && \
chmod +x ./kubectl
WORKDIR /src
CMD tail -f /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment