Skip to content

Commit

Permalink
feat(frontend): Switch to upstream frontend v1.3.0
Browse files Browse the repository at this point in the history
Signed-off-by: sylus <sylus1984@gmail.com>
  • Loading branch information
sylus committed Feb 16, 2022
1 parent cd1e003 commit dfa205f
Show file tree
Hide file tree
Showing 462 changed files with 32,257 additions and 15,915 deletions.
52 changes: 47 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,58 @@
name: build
on: [pull_request]
name: Build

on:
pull_request:
branches:
- main

env:
K3D_VERSION: 4.4.7
KUBECTL_VERSION: 1.21.2
KUSTOMIZE_VERSION: 4.1.3
REGISTRY_NAME: k8scc01covidacr

jobs:
build:
test:
name: 'Test'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
- name: Checkout
uses: actions/checkout@v2

- name: Gather dependencies
run: |
mkdir -p ${GITHUB_WORKSPACE}/bin/
# install kubectl
curl -L https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl -o ${GITHUB_WORKSPACE}/bin/kubectl && chmod +x ${GITHUB_WORKSPACE}/bin/kubectl
# install kustomize
curl -L https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz -o kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz && tar -zxvf kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz && chmod +x kustomize && mv kustomize ${GITHUB_WORKSPACE}/bin/kustomize
# install k3d
curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | TAG=v${K3D_VERSION} bash
# install taskfile
curl -sL https://taskfile.dev/install.sh | sh
# install yq
sudo snap install yq
- name: GitHub Path
run: |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
- name: Build Binary
run: |
task go:build
- name: Linting
run: |
task go:vet
- run: |
- name: Build Container
run: |
docker build -f Dockerfile -t ${{ env.REGISTRY_NAME }}.azurecr.io/jupyter-apis:${{ github.sha }} .
- uses: Azure/container-scan@v0
Expand Down
54 changes: 0 additions & 54 deletions .github/workflows/test.yml

This file was deleted.

18 changes: 11 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# Stage 0: UI Build Stage
FROM node:12-buster-slim as frontend
WORKDIR /src
COPY ./jupyter/frontend/package*.json ./
COPY ./jupyter/frontend/tsconfig*.json ./
COPY ./jupyter/frontend/angular.json ./
COPY ./jupyter/frontend/src ./src
ENV NG_CLI_ANALYTICS "ci"
COPY ./frontend/common/kubeflow-common-lib/package*.json ./
RUN npm ci
COPY --from=frontend-kubeflow-lib /src/dist/kubeflow/ ./node_modules/kubeflow/
COPY ./frontend/common/kubeflow-common-lib/ .
RUN npm run build
COPY ./frontend/jupyter/package*.json ./
COPY ./frontend/jupyter/tsconfig*.json ./
COPY ./frontend/jupyter/angular.json ./
COPY ./frontend/jupyter/src ./src
RUN npm ci
RUN cp -R /src/dist/kubeflow/ ./node_modules/kubeflow/
RUN npm run build -- --output-path=./dist/default --configuration=production
RUN npm run build -- --output-path=./dist/rok --configuration=rok-prod

Expand All @@ -21,9 +25,9 @@ RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go install .

# Generate final image
# Stage 2: Generate final image
FROM scratch
COPY --from=frontend /app/dist/out/default /static/
COPY --from=frontend /src/dist/default /static/
COPY --from=backend /go/bin/jupyter-apis /jupyter-apis
ENV LISTEN_ADDRESS 0.0.0.0:5000
EXPOSE 5000
Expand Down
18 changes: 18 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ vars:

CLUSTER_NAME: jupyter-apis
CONTEXT_NAME: "k3d-{{.CLUSTER_NAME}}"
CONTAINER_IMAGE_NAME: jupyter-apis
CONTAINER_IMAGE_TAG: {sh: git rev-parse HEAD}
CONTAINER_IMAGE: "{{.CONTAINER_IMAGE_NAME}}:{{.CONTAINER_IMAGE_TAG}}"
KUBECTL: "kubectl --context={{.CONTEXT_NAME}}"
KUBEAPPLY: "{{.KUBECTL}} apply"
KUSTOMIZE: "{{.KUBEAPPLY}} --kustomize"
Expand Down Expand Up @@ -59,6 +62,21 @@ tasks:
deps:
- task: go:format

docker:build:
desc: Build the container image
cmds:
- docker build -t {{.CONTAINER_IMAGE}} -f Dockerfile .

docker:enter:
desc: Enter into the built container
cmds:
- docker run -it --rm --entrypoint=sh {{.CONTAINER_IMAGE}}

docker:push:
desc: Push the built container image
cmds:
- docker push {{.CONTAINER_IMAGE}}

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/go-task/Taskfile.yml
go:build:
desc: Build the Go code
Expand Down
202 changes: 0 additions & 202 deletions frontend/LICENSE

This file was deleted.

File renamed without changes.
Loading

0 comments on commit dfa205f

Please sign in to comment.