From d69400ef81de7ad38d16bc532e55d7b002438711 Mon Sep 17 00:00:00 2001 From: Brendan Bergen Date: Thu, 5 Sep 2024 13:11:21 -0600 Subject: [PATCH] WIP: Create VSCode Dev Container - Add a new stage to ci-rp to include all local build tools - Add config for vscode Dev Containers extension --- .devcontainer/devcontainer.json | 51 +++++++++++++++++++++++++++++++++ Dockerfile.ci-rp | 27 +++++++++++++---- 2 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000000..28df9595b5b --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,51 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile +{ + "name": "aro-rp dev", + "build": { + // Sets the run context to one level up instead of the .devcontainer folder. + "context": "..", + // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. + "dockerfile": "../Dockerfile.ci-rp", + "target": "rp-dev", + "args": { + "REGISTRY": "registry.access.redhat.com" + } + }, + "runArgs": [ + // our builds are crazy big - need more resources + "--ulimit=nofile=8192:8192" + ], + "postCreateCommand": "go mod download && make install-tools", + + // Podman required config + "remoteUser": "root", + "privileged": true, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + // ARO RP API + 8443, + + // SRE Portal Web UI + 8444, + + // SRE Portal SSH Port + 2222 + ], + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "settings": {}, + "extensions": [ + "golang.go", + "ms-vscode.makefile-tools", + "ms-vsliveshare.vsliveshare" + ] + } + } +} diff --git a/Dockerfile.ci-rp b/Dockerfile.ci-rp index 219724c1974..d2cae373eb1 100644 --- a/Dockerfile.ci-rp +++ b/Dockerfile.ci-rp @@ -1,6 +1,27 @@ ARG REGISTRY ARG ARO_VERSION +############################################################################### +# Stage 0: Dev Container Base Image +############################################################################### +FROM ${REGISTRY}/ubi8/go-toolset:1.21.11-1.1720406008 AS rp-dev +USER root +RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc \ + && dnf install -y https://packages.microsoft.com/config/rhel/8/packages-microsoft-prod.rpm \ + && dnf install -y \ + azure-cli \ + gpgme-devel \ + libassuan-devel \ + llvm-devel \ + openssl \ + make \ + podman \ + && dnf upgrade -y + +WORKDIR /app + +ENV GOPATH=/root/go + ############################################################################### # Stage 1: Build the SRE Portal Assets ############################################################################### @@ -22,14 +43,10 @@ LABEL stage="portal-build-cache-layer" ############################################################################### # Stage 2: Compile the Golang RP code ############################################################################### -FROM ${REGISTRY}/ubi8/go-toolset:1.21.11-1.1720406008 AS builder +FROM rp-dev AS builder ARG ARO_VERSION LABEL aro-builder=true -USER root -WORKDIR /app -# golang config and build steps -ENV GOPATH=/root/go ENV GOFLAGS="-tags=containers_image_openpgp,exclude_graphdriver_btrfs,exclude_graphdriver_devicemapper" COPY .bingo .bingo