Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use docker or podman to build and run #596

Merged
merged 3 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ __pycache__/
.bundle/
vendor/
.ruby-version

# Samples
samples/**/*.project
samples/**/*.classpath
samples/**/*.gradle
samples/**/*.settings
40 changes: 31 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ LDFLAGS += -X github.com/konveyor/${BINNAME}/types/info.gitCommit=${GIT_COMMIT}
LDFLAGS += -X github.com/konveyor/${BINNAME}/types/info.gitTreeState=${GIT_DIRTY}
LDFLAGS += -extldflags "-static"

# Setting container tool
DOCKER_CMD := $(shell command -v docker 2> /dev/null)
PODMAN_CMD := $(shell command -v podman 2> /dev/null)

ifdef DOCKER_CMD
CONTAINER_TOOL = 'docker'
else ifdef PODMAN_CMD
CONTAINER_TOOL = 'podman'
endif

# HELP
# This will output the help for each task
.PHONY: help
Expand Down Expand Up @@ -171,17 +181,29 @@ info: ## Get version info
@echo "Git Commit: ${GIT_COMMIT}"
@echo "Git Tree State: ${GIT_DIRTY}"

# -- Docker --
# -- Container Image --

.PHONY: cbuild
cbuild: ## Build docker image
docker build -t ${REGISTRYNS}/${BINNAME}-builder:${VERSION} --cache-from ${REGISTRYNS}/${BINNAME}-builder:latest --target build_base --build-arg VERSION=${VERSION} --build-arg GO_VERSION=${GO_VERSION} .
docker build -t ${REGISTRYNS}/${BINNAME}:${VERSION} --cache-from ${REGISTRYNS}/${BINNAME}-builder:latest --cache-from ${REGISTRYNS}/${BINNAME}:latest --build-arg VERSION=${VERSION} --build-arg GO_VERSION=${GO_VERSION} .
docker tag ${REGISTRYNS}/${BINNAME}-builder:${VERSION} ${REGISTRYNS}/${BINNAME}-builder:latest
docker tag ${REGISTRYNS}/${BINNAME}:${VERSION} ${REGISTRYNS}/${BINNAME}:latest
cbuild: ## Build container image
ifndef CONTAINER_TOOL
$(error No container tool (docker, podman) found in your environment. Please, install one)
endif

@echo "Building image with $(CONTAINER_TOOL)"

${CONTAINER_TOOL} build -t ${REGISTRYNS}/${BINNAME}-builder:${VERSION} --cache-from ${REGISTRYNS}/${BINNAME}-builder:latest --target build_base --build-arg VERSION=${VERSION} --build-arg GO_VERSION=${GO_VERSION} .
${CONTAINER_TOOL} build -t ${REGISTRYNS}/${BINNAME}:${VERSION} --cache-from ${REGISTRYNS}/${BINNAME}-builder:latest --cache-from ${REGISTRYNS}/${BINNAME}:latest --build-arg VERSION=${VERSION} --build-arg GO_VERSION=${GO_VERSION} .
${CONTAINER_TOOL} tag ${REGISTRYNS}/${BINNAME}-builder:${VERSION} ${REGISTRYNS}/${BINNAME}-builder:latest
${CONTAINER_TOOL} tag ${REGISTRYNS}/${BINNAME}:${VERSION} ${REGISTRYNS}/${BINNAME}:latest

.PHONY: cpush
cpush: ## Push docker image
cpush: ## Push container image
ifndef CONTAINER_TOOL
$(error No container tool (docker, podman) found in your environment. Please, install one)
endif

@echo "Pushing image with $(CONTAINER_TOOL)"

# To help with reusing layers and hence speeding up build
docker push ${REGISTRYNS}/${BINNAME}-builder:${VERSION}
docker push ${REGISTRYNS}/${BINNAME}:${VERSION}
${CONTAINER_TOOL} push ${REGISTRYNS}/${BINNAME}-builder:${VERSION}
${CONTAINER_TOOL} push ${REGISTRYNS}/${BINNAME}:${VERSION}
29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/konveyor/move2kube)](https://goreportcard.com/report/github.com/konveyor/move2kube)
[<img src="https://img.shields.io/badge/slack-konveyor/move2kube-green.svg?logo=slack">](https://kubernetes.slack.com/archives/CR85S82A2)


# Move2Kube

Move2Kube is a command-line tool that accelerates the process of re-platforming to Kubernetes/Openshift. It does so by analysing the environment and source artifacts, and asking guidance from the user when required. It allows customizations to enable generating the directory structure and artifacts in the format required for your project.
Move2Kube is a command-line tool that accelerates the process of re-platforming to Kubernetes/Openshift. It does so by analyzing the environment and source artifacts, and asking guidance from the user when required. It allows customizations to enable generating the directory structure and artifacts in the format required for your project.

![Usage](./imgs/overview.png)

Expand All @@ -16,23 +15,26 @@ Move2Kube is a command-line tool that accelerates the process of re-platforming
### Using install script

To install the latest stable version:
```

```shell
bash <(curl https://raw.githubusercontent.com/konveyor/move2kube/main/scripts/install.sh)
```

To install a specific version (for example version `v0.2.0-alpha.3`):
```

```shell
MOVE2KUBE_TAG='v0.2.0-alpha.3' bash <(curl https://raw.githubusercontent.com/konveyor/move2kube/main/scripts/install.sh)
```

To install the bleeding edge version:
```

```shell
BLEEDING_EDGE='true' bash <(curl https://raw.githubusercontent.com/konveyor/move2kube/main/scripts/install.sh)
```

### Using Homebrew

```
```shell
brew tap konveyor/move2kube
brew install move2kube
```
Expand All @@ -41,16 +43,25 @@ brew install move2kube

To bring up UI version:

```
Using `docker`:

```shell
docker run --rm -it -p 8080:8080 quay.io/konveyor/move2kube-ui:latest
```

Using `podman`:

```shell
podman run --rm -it -p 8080:8080 quay.io/konveyor/move2kube-ui:latest
```

Then go to http://localhost:8080 in a browser

More detailed instructions can be found in the [Move2Kube UI repo](https://github.com/konveyor/move2kube-ui#starting-the-ui)

## Usage

`move2kube transform -s src` , where src is the folder containing the source artifacts.
`move2kube transform -s src`, where `src` is the folder containing the source artifacts.

Checkout the [Getting started](https://move2kube.konveyor.io/docs/getting-started) guide and [Tutorials](https://move2kube.konveyor.io/docs/tutorial) for more information.

Expand Down Expand Up @@ -91,7 +102,7 @@ To browse code [![Open in VSCode](https://open.vscode.dev/badges/open-in-vscode.
* Kubernetes/Openshift Yamls
* Helm charts
* Kustomize
* Openshift Templates
* OpenShift Templates
* Operator
* Docker compose

Expand Down