-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use docker base image provide the needed dependencies.
- Loading branch information
Showing
2 changed files
with
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
FROM debian:stretch-slim | ||
FROM docker:stable | ||
MAINTAINER Jan Boonen <[email protected]> | ||
|
||
ARG VERSION | ||
ENV OS "linux" | ||
ENV BIT "64" | ||
|
||
RUN echo "Installing curl..." && \ | ||
apt update && apt install -y curl && \ | ||
if [ x$VERSION = 'latest' ] ; then \ | ||
RUN apk add --no-cache curl | ||
|
||
RUN VERSION=${VERSION:-latest} && \ | ||
if [ $VERSION = 'latest' ]; then \ | ||
echo "Downloading latest version of Operator SDK from Github..." && \ | ||
curl -sL https://api.github.com/repos/operator-framework/operator-sdk/releases |\ | ||
grep browser_download |\ | ||
grep $OS |\ | ||
grep ${OS} |\ | ||
cut -d '"' -f 4 |\ | ||
grep operator-sdk |\ | ||
grep x86_$BIT-$OS |\ | ||
grep x86_${BIT}-${OS} |\ | ||
grep -v .asc |\ | ||
head -n 1 |\ | ||
xargs curl -sOL; \ | ||
else \ | ||
echo "Downloading version $VERSION of Operator SDK from Github..." && \ | ||
curl -sOL "https://github.com/operator-framework/operator-sdk/releases/download/v${VERSION}/operator-sdk-v${VERSION}-x86_${BIT}-${OS}-gnu"; \ | ||
fi && \ | ||
cp ./operator-sdk-* /usr/local/bin/operator-sdk && rm -f ./operator-sdk && \ | ||
cp ./operator-sdk-* /usr/local/bin/operator-sdk && rm -f ./operator-sdk* && \ | ||
chmod a+x /usr/local/bin/operator-sdk && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* && \ | ||
mkdir -p /source | ||
|
||
WORKDIR /source | ||
|
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,10 +1,17 @@ | ||
# operator-sdk | ||
Run the [Kubernetes Operator SDK](https://github.com/operator-framework/operator-sdk) using Docker. This is especially useful in environments where | ||
installing the binaries is not an option (e.g. in CI/CD pipelines). | ||
|
||
Run the [Kubernetes Operator SDK](https://github.com/operator-framework/operator-sdk) using Docker. This is especially | ||
useful in environments where installing the binaries is not an option (e.g. in CI/CD pipelines). The `latest` version of | ||
this image will be the latest release of the *Operator SDK*. | ||
|
||
## Usage | ||
Build a custom operator using the `operator-sdk` command: | ||
|
||
Before you start, you must have a Docker daemon running on the host machine. You can check this by using the command | ||
`docker version`. In order to build a custom operator using the `operator-sdk` binary, use the following command: | ||
|
||
```bash | ||
docker run --rm -v ${PWD}:/source build operator-image:operator-version | ||
docker run --rm -v ${PWD}:/source -v /var/run/docker.sock:/var/run/docker.sock --privileged boonen/operator-sdk:latest build operator-image:operator-version | ||
``` | ||
|
||
This command will mount the current working directory in `/source` and build the operator based on the source code in the | ||
working directory. |