diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 7a62e74..eb2238f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ # ghcr.io/eda-labs/eda-devcontainer -FROM mcr.microsoft.com/devcontainers/base:ubuntu +FROM public.ecr.aws/docker/library/debian:bookworm-slim ARG EDA_VERSION=25.12.1 ARG EDA_PLAYGROUND_REPO=kaelemc/playground @@ -9,22 +9,39 @@ ENV EDA_VERSION=${EDA_VERSION//./-} ENV EDA_PLAYGROUND_REPO=$EDA_PLAYGROUND_REPO ENV EDA_PLAYGROUND_DIR=$EDA_PLAYGROUND_DIR -RUN apt-get update && apt-get install -y \ +RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install --no-install-recommends -y \ make \ + git \ + ca-certificates \ curl \ jq \ btop \ + sudo \ + zsh \ && rm -rf /var/lib/apt/lists/* +RUN useradd -m -s /bin/zsh vscode && \ + groupadd -f docker && \ + usermod -aG sudo,docker vscode && \ + echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/vscode && \ + chmod 0440 /etc/sudoers.d/vscode + COPY --chmod=755 scripts/ /usr/local/bin/. +COPY codespaces-4vcpu-kpt-setters.yaml /eda-codespaces/codespaces-4vcpu-kpt-setters.yaml -RUN curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash +RUN curl -fsSL --retry 3 https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v5.8.3 bash -RUN echo "export PATH=$PATH:$EDA_PLAYGROUND_DIR/tools" >> /etc/profile +# Add EDA Playground tools to PATH (zsh) +RUN echo 'export PATH="$PATH:$EDA_PLAYGROUND_DIR/tools"' >> /etc/zsh/zshrc USER vscode -RUN git clone "https://github.com/$EDA_PLAYGROUND_REPO" $EDA_PLAYGROUND_DIR && cd $EDA_PLAYGROUND_DIR && make download-tools +RUN git clone --depth 1 "https://github.com/$EDA_PLAYGROUND_REPO" $EDA_PLAYGROUND_DIR && cd $EDA_PLAYGROUND_DIR && make download-tools RUN curl -o $HOME/.bundle.yaml "https://raw.githubusercontent.com/nokia-eda/edaadm/refs/heads/main/bundles/eda-bundle-core-$EDA_VERSION.yaml" && \ - $EDA_PLAYGROUND_DIR/tools/yq '.assets.registries[] | .name as $reg | .images[] | .name as $img | .tags[] | $reg + "/" + $img + ":" + .' $HOME/.bundle.yaml > $HOME/.images.txt \ No newline at end of file + $EDA_PLAYGROUND_DIR/tools/yq '.assets.registries[] | .name as $reg | .images[] | .name as $img | .tags[] | $reg + "/" + $img + ":" + .' $HOME/.bundle.yaml > $HOME/.images.txt + +SHELL ["/bin/bash", "-c"] +RUN SRL=$(curl -s "https://raw.githubusercontent.com/nokia-eda/playground/refs/heads/main/topology/3-nodes-srl.yaml" | $EDA_PLAYGROUND_DIR/tools/yq '.spec.nodeTemplates | filter(.name == "default").[].nodeProfile'); \ + curl "https://raw.githubusercontent.com/nokia-eda/kpt/refs/heads/main/eda-kpt-playground/$SRL/engine_v1_nodeprofile_srlinux_${SRL//[^0-9.]/}.yaml" | \ + $EDA_PLAYGROUND_DIR/tools/yq '.spec.containerImage' >> $HOME/.images.txt \ No newline at end of file diff --git a/.devcontainer/codespaces-4vcpu-kpt-setters.yaml b/.devcontainer/codespaces-4vcpu-kpt-setters.yaml new file mode 100644 index 0000000..14e76ea --- /dev/null +++ b/.devcontainer/codespaces-4vcpu-kpt-setters.yaml @@ -0,0 +1,30 @@ +# This setters file is meant for use in codespaces (4vcpu) VMs +# to provide configuration for the EDA platform +# It is applied in the codespaces post-create script as an argument to `make try-eda. +apiVersion: v1 +kind: ConfigMap +metadata: + name: codespaces-4vcpu-apply-setter-fn-config +data: + # AI Engine + EAE_REQ_CPU: 10m + # Artifact server + ASVR_REQ_CPU: 10m + # Bootstrap server + BSVR_REQ_CPU: 10m + # EDA Cert Checker + ECC_REQ_CPU: 10m + # EDA Metrics Server + EMS_REQ_CPU: 10m + # Identity Server - Keycloak + KC_REQ_CPU: 10m + # Appstore Controller + ASC_REQ_CPU: 10m + # Identity Server Database - Postgres + PG_REQ_CPU: 10m + # Flow Engine + FE_REQ_CPU: 10m + # NPP + NPP_REQ_CPU: 10m + # TestMan + TM_REQ_CPU: 10m diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c1ac02d..2c0d8a9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,6 @@ { "name": "Nokia EDA in GitHub Codespaces", - "image": "ghcr.io/eda-labs/eda-devcontainer:latest", + "image": "ghcr.io/eda-labs/codespaces/base:pr-1", "features": { "ghcr.io/devcontainers/features/docker-in-docker:2": { "version": "latest", @@ -46,7 +46,8 @@ "portsAttributes": { "9443": { "protocol": "https", - "label": "EDA UI" + "label": "EDA UI", + "onAutoForward": "openBrowser" } }, "hostRequirements": { diff --git a/.devcontainer/postCreate.sh b/.devcontainer/postCreate.sh index 3b3ae4e..0f2a018 100755 --- a/.devcontainer/postCreate.sh +++ b/.devcontainer/postCreate.sh @@ -5,6 +5,4 @@ cd $EDA_PLAYGROUND_DIR ensure-docker-is-ready -make try-eda NO_KIND=yes NO_LB=yes - -make configure-codespaces-keycloak \ No newline at end of file +make try-eda NO_KIND=yes NO_LB=yes KPT_SETTERS_FILE=/eda-codespaces/codespaces-4vcpu-kpt-setters.yaml \ No newline at end of file diff --git a/.github/workflows/build-devcontainer.yml b/.github/workflows/build-devcontainer.yml new file mode 100644 index 0000000..fb9d419 --- /dev/null +++ b/.github/workflows/build-devcontainer.yml @@ -0,0 +1,55 @@ +name: Build Devcontainer Image + +"on": + pull_request: + workflow_dispatch: + release: + types: + - published + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ghcr.io/eda-labs/codespaces/base + DOCKERFILE: .devcontainer/Dockerfile + CONTEXT: .devcontainer/ + +jobs: + build: + name: Build and Push + runs-on: ubuntu-24.04 + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=ref,event=tag + type=sha + + - name: Build and push image + uses: docker/build-push-action@v6 + with: + context: ${{ env.CONTEXT }} + file: ${{ env.DOCKERFILE }} + push: true + tags: ${{ steps.meta.outputs.tags }}