This commit is contained in:
Robert Schaedler III 2023-10-12 16:02:19 -07:00 коммит произвёл GitHub
Родитель 0ec429dcbe
Коммит 854832ac90
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 93 добавлений и 64 удалений

Просмотреть файл

@ -1,45 +1,20 @@
# Setup development environment for OSConfig (Base: devops/docker/ubuntu20.04-amd64/Dockerfile)
# Creates an image, pre-provisioned with all necessary SDKs and tools for working with OSConfig
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt -y update && apt-get -y install software-properties-common
RUN apt -y update && apt-get -y install \
apt-transport-https \
build-essential \
ca-certificates \
cmake \
curl \
gcovr \
gdb \
git \
jq \
libcurl4-openssl-dev \
FROM mcr.microsoft.com/devcontainers/cpp:1-debian-11
ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="3.22.2"
# Optionally install the cmake for vcpkg
COPY ./reinstall-cmake.sh /tmp/
RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \
chmod +x /tmp/reinstall-cmake.sh && /tmp/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE}; \
fi \
&& rm -f /tmp/reinstall-cmake.sh
# [Optional] Uncomment this section to install additional vcpkg ports.
# RUN su vscode -c "${VCPKG_ROOT}/vcpkg install <your-port-name-here>"
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive && apt-get -y install --no-install-recommends \
libgmock-dev \
libgtest-dev \
libssl-dev \
ninja-build \
python3-jsonschema \
rapidjson-dev \
uuid-dev \
wget
# CMake
RUN git clone https://github.com/Kitware/CMake --recursive -b v3.21.7
RUN cd CMake && ./bootstrap && make -j$(nproc) && make install && hash -r && rm -rf /git/CMake
# .NET Install
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg && \
cp ./microsoft.gpg /etc/apt/trusted.gpg.d/ && \
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > ./microsoft-prod.list && \
cp ./microsoft-prod.list /etc/apt/sources.list.d/ && \
apt update -y && apt install -y dotnet-sdk-6.0
# ZSH
ENV SHELL /bin/zsh
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.2/zsh-in-docker.sh)" -- \
-t https://github.com/denysdovhan/spaceship-prompt
# Terraform
RUN curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add - && \
apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main" && \
apt-get -y install terraform
uuid-dev

Просмотреть файл

@ -1,26 +1,21 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "azure-osconfig",
"dockerFile": "Dockerfile",
"features": {
"github-cli": "latest"
"build": {
"dockerfile": "Dockerfile"
},
"workspaceFolder": "/azure-osconfig",
"mounts": ["source=${localWorkspaceFolder},target=/azure-osconfig,type=bind,consistency=cached"],
"overrideCommand": true,
"postCreateCommand": "git config --global --add safe.directory /azure-osconfig && git submodule update --init --recursive",
"extensions": [
"eamodio.gitlens",
"GitHub.copilot",
"GitHub.vscode-pull-request-github",
"hashicorp.terraform",
"ms-azure-devops.azure-pipelines",
"ms-azuretools.vscode-azureterraform",
"ms-dotnettools.csharp",
"twxs.cmake",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"mhutchie.git-graph",
"me-dutour-mathieu.vscode-github-actions"
]
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {}
},
"postCreateCommand": "git submodule update --init",
"customizations": {
"vscode": {
"extensions": [
"github.copilot"
]
}
},
"remoteUser": "root"
}

Просмотреть файл

@ -0,0 +1,59 @@
#!/usr/bin/env bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
#
set -e
CMAKE_VERSION=${1:-"none"}
if [ "${CMAKE_VERSION}" = "none" ]; then
echo "No CMake version specified, skipping CMake reinstallation"
exit 0
fi
# Cleanup temporary directory and associated files when exiting the script.
cleanup() {
EXIT_CODE=$?
set +e
if [[ -n "${TMP_DIR}" ]]; then
echo "Executing cleanup of tmp files"
rm -Rf "${TMP_DIR}"
fi
exit $EXIT_CODE
}
trap cleanup EXIT
echo "Installing CMake..."
apt-get -y purge --auto-remove cmake
mkdir -p /opt/cmake
architecture=$(dpkg --print-architecture)
case "${architecture}" in
arm64)
ARCH=aarch64 ;;
amd64)
ARCH=x86_64 ;;
*)
echo "Unsupported architecture ${architecture}."
exit 1
;;
esac
CMAKE_BINARY_NAME="cmake-${CMAKE_VERSION}-linux-${ARCH}.sh"
CMAKE_CHECKSUM_NAME="cmake-${CMAKE_VERSION}-SHA-256.txt"
TMP_DIR=$(mktemp -d -t cmake-XXXXXXXXXX)
echo "${TMP_DIR}"
cd "${TMP_DIR}"
curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_BINARY_NAME}" -O
curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_CHECKSUM_NAME}" -O
sha256sum -c --ignore-missing "${CMAKE_CHECKSUM_NAME}"
sh "${TMP_DIR}/${CMAKE_BINARY_NAME}" --prefix=/opt/cmake --skip-license
ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
ln -s /opt/cmake/bin/ctest /usr/local/bin/ctest