Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Docker image for Ubuntu 24.04 and Clang/LLVM 18 #303

Merged
merged 10 commits into from
Jul 2, 2024
10 changes: 5 additions & 5 deletions .docker/netremote-dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
FROM ubuntu:noble as netremote-build

# Set arguments used only in this Dockerfile.
ARG BUILD_DATE="2024-06-20T16:36:23Z"
ARG BUILD_DATE="2024-06-30T02:17:53+00:00"
ARG DEBIAN_FRONTEND=noninteractive
ARG APT_ARGS_COMMON="-yqq --no-install-recommends"

LABEL maintainer="Andrew Beltrano (anbeltra@microsoft.com)"
LABEL org.opencontainers.image.authors = "netremoteowners@microsoft.com"
LABEL org.label-schema.build-date = "${BUILD_DATE}"
LABEL org.label-schema.name = "Microsoft NetRemote build environment"
LABEL org.label-schema.name = "NetRemote build environment"
LABEL org.label-schema.description = "Build environment for the NetRemote project"
LABEL org.label-schema.vendor = "Microsoft"
LABEL org.label-schema.version = "1.0.0"
Expand Down Expand Up @@ -128,7 +128,7 @@ RUN mkdir -p ${VCPKG_BINARY_CACHE}
# Obtain vcpkg, bootstrap it, and install dependencies.
COPY vcpkg.json .

RUN git clone https://github.com/microsoft/vcpkg.git --depth 1 && \
RUN git clone https://github.com/microsoft/vcpkg.git && \
./vcpkg/bootstrap-vcpkg.sh && \
./vcpkg/vcpkg install --clean-buildtrees-after-build --clean-downloads-after-build

Expand All @@ -140,7 +140,7 @@ ENTRYPOINT [ "/bin/entrypoint-build.sh" ]

FROM netremote-build as netremote-dev

LABEL org.label-schema.name = "Microsoft NetRemote development environment"
LABEL org.label-schema.name = "NetRemote development environment"
LABEL org.label-schema.description = "Development environment for the NetRemote project"

# Install packages.
Expand Down
37 changes: 24 additions & 13 deletions .docker/netremote-dev/entrypoint-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,24 @@

set -euf -o pipefail

REPOSITORY_ROOT=${1:-${PWD}}
readonly REPOSITORY_ROOT="${1:-${PWD}}"
readonly CMAKE_PRESET_CONFIGURE="${2:-cicd-linux}"
readonly CMAKE_PRESET_BUILD="${3:-build-cicd-linux}"
readonly CMAKE_PRESET_PACKAGE="${4:-cicd-linux}"
readonly CMAKE_PRESET_TEST="${5:-test-cicd-linux}"
readonly CMAKE_BUILD_CONFIG="${6:-Debug}"

echo "------------------------------------"
echo "Build entrypoint script parameters:"
echo "------------------------------------"
echo "Source Repository Root=${REPOSITORY_ROOT}"
echo "CMake"
echo " Build Configuration=${CMAKE_BUILD_CONFIG}"
echo " Presets"
echo " Configure='${CMAKE_PRESET_CONFIGURE}'"
echo " Build='${CMAKE_PRESET_BUILD}'"
echo " Test='${CMAKE_PRESET_TEST}'"
echo " Package='${CMAKE_PRESET_PACKAGE}'"

# Verify the repository root is a git repository.
if [[ ! -d ${REPOSITORY_ROOT}/.git ]]; then
Expand All @@ -16,17 +33,11 @@ if [[ ! -f ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake ]]; then
exit 1
fi

# Assign cmake presets.
# TODO: these should be passed in as arguments instead.
PRESET_CONFIGURE=release-linux
PRESET_BUILD=release-linux-debug
BUILD_CONFIG=Debug

# Add the workspace directory to the safe directory list.
git config --global --add safe.directory ${REPOSITORY_ROOT}
git config --global --add safe.directory "${REPOSITORY_ROOT}"

# Change to the root of the repo.
cd ${REPOSITORY_ROOT}
cmake --preset ${PRESET_CONFIGURE}
cmake --build --preset ${PRESET_BUILD}
cmake --install out/build/${PRESET_CONFIGURE} --config ${BUILD_CONFIG}
# Change to the root of the repo then execute then perform CMake configure, build, and test.
cd "${REPOSITORY_ROOT}"
cmake --preset "${CMAKE_PRESET_CONFIGURE}"
cmake --build --preset "${CMAKE_PRESET_BUILD}"
ctest --preset "${CMAKE_PRESET_TEST}" -C "${CMAKE_BUILD_CONFIG}"
21 changes: 21 additions & 0 deletions .github/actions/build-with-docker/action.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@

name: 'Build'
description: 'Build the repository in a docker container'
inputs:
cmake-preset-configure:
required: false
default: 'dev-linux'
description: 'The name of the preset to use for the CMake configure operation'
cmake-preset-build:
required: false
default: 'build-dev-linux'
description: 'The name of the preset to use for the CMake build operation'
cmake-preset-package:
required: false
default: 'packaging-dev-linux'
description: 'The name of the preset to use for the CMake package operation'
cmake-build-config:
required: false
default: 'Debug'
description: 'The build configuration to use for the CMake build operation'
runs:
using: 'docker'
image: 'docker://abeltrano/netremote-build:latest'
args:
- '/github/workspace'
- ${{ inputs.cmake-preset-configure }}
- ${{ inputs.cmake-preset-build }}
- ${{ inputs.cmake-preset-package }}
- ${{ inputs.cmake-build-config }}