forked from flyteorg/flyte
-
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.
New CI/CD for sandbox bundled and flyte single binary images (flyteor…
…g#2994) Signed-off-by: Yuvraj <[email protected]>
- Loading branch information
Showing
14 changed files
with
1,343 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
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
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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
ARG FLYTE_VERSION="latest" | ||
|
||
FROM ghcr.io/flyteorg/flyteconsole-release:$FLYTE_VERSION AS flyteconsole | ||
|
||
|
||
FROM golang:1.19.1-bullseye AS flytebuilder | ||
|
||
ARG FLYTE_VERSION="master" | ||
|
||
WORKDIR /flyteorg/build | ||
RUN git clone --depth=1 https://github.com/flyteorg/flyte.git ./flyte -b $FLYTE_VERSION | ||
WORKDIR /flyteorg/build/flyte | ||
RUN go mod download | ||
COPY --from=flyteconsole /app/dist cmd/single/dist | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/root/go/pkg/mod \ | ||
go build -tags console -v -o dist/flyte cmd/main.go | ||
|
||
|
||
FROM gcr.io/distroless/base-debian11 | ||
|
||
COPY --from=flytebuilder /flyteorg/build/flyte/dist/flyte /flyte | ||
ENTRYPOINT [ "/flyte" ] |
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
.SILENT: help | ||
.PHONY: help | ||
help: | ||
echo Available recipes: | ||
cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' | awk 'BEGIN { FS = ":.*?## " } { cnt++; a[cnt] = $$1; b[cnt] = $$2; if (length($$1) > max) max = length($$1) } END { for (i = 1; i <= cnt; i++) printf " $(shell tput setaf 6)%-*s$(shell tput setaf 0) %s\n", max, a[i], b[i] }' | ||
tput sgr0 | ||
|
||
export DOCKER_BUILDKIT := 1 | ||
|
||
.PHONY: images | ||
images: | ||
mkdir -p docker/sandbox-bundled/images/dockerfiles/tar/arm64 | ||
mkdir -p docker/sandbox-bundled/images/dockerfiles/tar/amd64 | ||
docker pull ghcr.io/flyteorg/flyte-binary:$(VERSION) --platform linux/arm64 | ||
docker tag ghcr.io/flyteorg/flyte-binary:$(VERSION) ghcr.io/flyteorg/flyte-binary:latest | ||
docker save --output docker/sandbox-bundled/images/dockerfiles/tar/arm64/flyte.tar ghcr.io/flyteorg/flyte-binary:latest | ||
docker rmi ghcr.io/flyteorg/flyte-binary | ||
docker pull ghcr.io/flyteorg/flyte-binary:$(VERSION) --platform linux/amd64 | ||
docker tag ghcr.io/flyteorg/flyte-binary:$(VERSION) ghcr.io/flyteorg/flyte-binary:latest | ||
docker save --output docker/sandbox-bundled/images/dockerfiles/tar/amd64/flyte.tar ghcr.io/flyteorg/flyte-binary:latest | ||
|
||
.PHONY: images-ci | ||
images-ci: | ||
mkdir -p images/dockerfiles/tar/arm64 | ||
mkdir -p images/dockerfiles/tar/amd64 | ||
cp /tmp/flyte-amd64.tar images/dockerfiles/tar/amd64/flyte.tar | ||
cp /tmp/flyte-arm64.tar images/dockerfiles/tar/arm64/flyte.tar | ||
|
||
.PHONY: clean | ||
clean: ## Cleanup state | ||
rm -rf data | ||
|
||
.PHONY: build | ||
build: images | ||
docker build -t flyte-sandbox -f images/dockerfiles/k3s/Dockerfile . | ||
|
||
data/flyte.yaml: | ||
mkdir -p $(shell dirname $@) | ||
cp bootstrap/flyte/flyte.yaml $@ | ||
|
||
.PHONY: start | ||
start: ## Start sandbox | ||
[ -n "$(shell docker ps --filter name=^flyte-sandbox$$ --format {{.Names}})" ] || \ | ||
docker run --detach --rm --privileged --name flyte-sandbox --volume $(PWD)/data:/srv/flyte --env K3S_KUBECONFIG_OUTPUT=/srv/flyte/kubeconfig --publish "6443" --publish "30000:30000" --publish "30001:30001" --publish "30002:30002" --publish "30080:30080" docker.io/library/flyte-sandbox | ||
|
||
.PHONY: kubeconfig | ||
.SILENT: kubeconfig | ||
kubeconfig: ## Set up kubeconfig | ||
sed -i -e "/server:/ s/: .*/: https:\/\/127.0.0.1:$(shell docker port flyte-sandbox | grep ^6443 | awk '{print $$3}' | awk -F: '{print $$2}')/" data/kubeconfig | ||
echo "export KUBECONFIG=$(PWD)/data/kubeconfig" | ||
|
||
.PHONY: stop | ||
stop: ## Stop sandbox | ||
docker stop flyte-sandbox | ||
|
||
.PHONY: console | ||
console: ## Open Flyte console in browser | ||
open http://localhost:30080/console | ||
|
||
.venv: | ||
python -m venv .venv | ||
. .venv/bin/activate && pip install flytekit | ||
|
||
.PHONY: example | ||
example: export FLYTECTL_CONFIG := example/config.yaml | ||
example: .venv ## Run example script | ||
. .venv/bin/activate && pyflyte run --remote example/example.py wf --n 500 --mean 42 --sigma 2 |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Flyte Deployment Sandbox | ||
|
||
First make images | ||
``` | ||
ytong@Yees-MBP:~/go/src/github.com/flyteorg/flyte/docker/sandbox-ultra [flyte-sandbox] (cicd-sandbox-lite) $ make images | ||
``` | ||
|
||
then build the k3s image. | ||
``` | ||
ytong@Yees-MBP:~/go/src/github.com/flyteorg/flyte/docker/sandbox-ultra [] (cicd-sandbox-lite) $ docker buildx build --file images/dockerfiles/k3s/Dockerfile --platform linux/arm64,linux/amd64 --push --tag ghcr.io/flyteorg/flyte-sandbox-lite:ultra7 . | ||
``` |
Oops, something went wrong.