Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
tariq-hasan committed Aug 24, 2024
1 parent 6fbac8c commit 3f65fe7
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 52 deletions.
57 changes: 47 additions & 10 deletions .github/workflows/template-publish-image/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,50 @@ runs:
type=raw,latest
type=sha,prefix=v1beta1-
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
file: ${{ inputs.dockerfile }}
push: ${{ inputs.push }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: ${{ inputs.platforms }}
- name: Build multi-arch Image
run: |
CPU_ARCH=linux/amd64 IMG=${{ inputs.image }} DOCKERFILE=${{ inputs.dockerfile }} make docker-build-multi-arch
CPU_ARCH=linux/arm64 IMG=${{ inputs.image }} DOCKERFILE=${{ inputs.dockerfile }} make docker-build-multi-arch
# - name: Build and Push
# uses: docker/build-push-action@v6
# with:
# context: .
# file:
# push: ${{ inputs.push }}
# tags: ${{ steps.meta.outputs.tags }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
# platforms: ${{ inputs.platforms }}



# name: TWA Multi-Arch Build Test
# on:
# pull_request:
# paths:
# - components/crud-web-apps/tensorboards/**
# - components/crud-web-apps/common/**
# branches:
# - master
# - v*-branch

# concurrency:
# group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
# cancel-in-progress: true

# env:
# IMG: tensorboards-web-app

# jobs:
# build:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3

# - name: Setup QEMU
# uses: docker/setup-qemu-action@v2

# - name: Setup Docker Buildx
# uses: docker/setup-buildx-action@v2
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,20 @@ pytest-skopt:
pip install --prefer-binary -r test/unit/v1beta1/requirements.txt
pip install --prefer-binary -r cmd/suggestion/skopt/v1beta1/requirements.txt
pytest ./test/unit/v1beta1/suggestion/test_skopt_service.py

# docker-build:
# cd ../ && docker build -t ${IMG}:${TAG} -f ${DOCKERFILE} .

# docker-push:
# docker push $(IMG):$(TAG)

.PHONY: docker-build-multi-arch
docker-build-multi-arch: ## Build multi-arch docker images with docker buildx
cd ../ && docker buildx build --platform ${CPU_ARCH} --tag ${IMG}:latest -f ${DOCKERFILE} .


# .PHONY: docker-build-push-multi-arch
# docker-build-push-multi-arch: ## Build multi-arch docker images with docker buildx and push to docker registry
# cd ../ && docker buildx build --platform ${ARCH} --tag ${IMG}:${TAG} --push -f ${DOCKERFILE} .

# image: docker-build docker-push
81 changes: 40 additions & 41 deletions cmd/ui/v1beta1/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# --- Build the backend ---
FROM golang:alpine AS go-build

ARG TARGETARCH

WORKDIR /go/src/github.com/kubeflow/katib

# Download packages.
COPY go.mod .
COPY go.sum .
RUN go mod download -x

# Copy sources.
COPY cmd/ cmd/
COPY pkg/ pkg/

# Build the binary.
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -a -o katib-ui ./cmd/ui/v1beta1

# --- Clone the kubeflow/kubeflow code ---
FROM ubuntu AS fetch-kubeflow-kubeflow

Expand All @@ -11,59 +30,39 @@ RUN git clone https://github.com/tariq-hasan/kubeflow.git && \
git checkout $COMMIT

# --- Build the frontend kubeflow library ---
FROM node:16 AS frontend-kubeflow-lib
FROM node:16-bullseye-slim as frontend-kubeflow-lib

WORKDIR /src

ENV NG_CLI_ANALYTICS "ci"
ARG LIB=/kf/kubeflow/components/crud-web-apps/common/frontend/kubeflow-common-lib
COPY --from=fetch-kubeflow-kubeflow $LIB/package*.json ./
RUN npm config set fetch-retry-mintimeout 20000 && \
npm config set fetch-retry-maxtimeout 120000 && \
npm config get registry && \
npm config set registry https://registry.npmjs.org/ && \
npm config get https-proxy && \
npm config rm https-proxy && \
npm ci

COPY --from=fetch-kubeflow-kubeflow $LIB/ ./
COPY --from=fetch-kubeflow-kubeflow $LIB/package.json ./
COPY --from=fetch-kubeflow-kubeflow $LIB/package-lock.json ./
RUN npm ci

COPY --from=fetch-kubeflow-kubeflow $LIB/projects ./projects
COPY --from=fetch-kubeflow-kubeflow $LIB/angular.json .
COPY --from=fetch-kubeflow-kubeflow $LIB/tsconfig.json .
RUN npm run build

# --- Build the frontend ---
FROM node:16 AS frontend
FROM node:16-bullseye-slim AS frontend

WORKDIR /src
COPY ./pkg/ui/v1beta1/frontend/package*.json ./
RUN npm config set fetch-retry-mintimeout 20000 && \
npm config set fetch-retry-maxtimeout 120000 && \
npm config get registry && \
npm config set registry https://registry.npmjs.org/ && \
npm config get https-proxy && \
npm config rm https-proxy && \
npm ci

COPY ./pkg/ui/v1beta1/frontend/ .
COPY --from=frontend-kubeflow-lib /src/dist/kubeflow/ ./node_modules/kubeflow/

RUN npm run build:prod

# --- Build the backend ---
FROM golang:alpine AS go-build

ARG TARGETARCH

WORKDIR /go/src/github.com/kubeflow/katib

# Download packages.
COPY go.mod .
COPY go.sum .
RUN go mod download -x
COPY ./pkg/ui/v1beta1/frontend/package.json ./
COPY ./pkg/ui/v1beta1/frontend/package-lock.json ./
COPY ./pkg/ui/v1beta1/frontend/tsconfig.json ./
COPY ./pkg/ui/v1beta1/frontend/tsconfig.app.json ./
COPY ./pkg/ui/v1beta1/frontend/tsconfig.spec.json ./
COPY ./pkg/ui/v1beta1/frontend/angular.json ./
COPY ./pkg/ui/v1beta1/frontend/src ./src

# Copy sources.
COPY cmd/ cmd/
COPY pkg/ pkg/
ENV NG_CLI_ANALYTICS "ci"
RUN npm ci
COPY --from=frontend-kubeflow-lib /src/dist/kubeflow/ ./node_modules/kubeflow/

# Build the binary.
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -a -o katib-ui ./cmd/ui/v1beta1
RUN npm run build:prod

# --- Compose the web app ---
FROM alpine:3.15
Expand Down
2 changes: 1 addition & 1 deletion pkg/ui/v1beta1/frontend/COMMIT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d582b9088
7e52c174d

0 comments on commit 3f65fe7

Please sign in to comment.