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

Modifications to containers for building debians using standard ubuntu packages #10

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .devcontainer/Dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM ubuntu:22.04

RUN apt-get update --fix-missing \
&& apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
cmake \
git \
libcli11-dev \
libeigen3-dev \
libgrpc++-dev \
libprotobuf-dev \
g++ \
pkg-config \
protobuf-compiler \
protobuf-compiler-grpc \
python3 \
curl \
ninja-build \
tar \
zip \
unzip \
zlib1g-dev \
libssl-dev \
wget \
&& apt-get autoclean \
&& apt-get autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN update-ca-certificates

COPY entrypoint.sh .
27 changes: 27 additions & 0 deletions .devcontainer/Dockerfile.amd64_vcpkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM ubuntu:22.04

RUN apt-get update --fix-missing &&\
apt-get install -y --no-install-recommends build-essential ca-certificates git g++ pkg-config python3 curl ninja-build tar zip unzip zlib1g-dev libssl-dev wget &&\
apt-get autoclean &&\
apt-get autoremove &&\
apt-get clean &&\
rm -rf /var/lib/apt/lists/*

RUN update-ca-certificates

RUN wget https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3.tar.gz &&\
tar -xzf cmake-3.28.3.tar.gz &&\
cd cmake-3.28.3 &&\
./configure &&\
make install &&\
cd .. &&\
rm cmake-3.28.3.tar.gz &&\
rm -r cmake-3.28.3

RUN git clone https://github.com/microsoft/vcpkg &&\
cd vcpkg &&\
git checkout 3b213864579b6fa686e38715508f7cd41a50900f &&\
./bootstrap-vcpkg.sh -disableMetrics &&\
./vcpkg install grpc:x64-linux &&\
./vcpkg install eigen3:x64-linux &&\
./vcpkg install cli11:x64-linux
33 changes: 33 additions & 0 deletions .devcontainer/Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM arm64v8/ubuntu:22.04

RUN apt-get update --fix-missing \
&& apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
cmake \
git \
libcli11-dev \
libeigen3-dev \
libgrpc++-dev \
libprotobuf-dev \
g++ \
pkg-config \
protobuf-compiler \
protobuf-compiler-grpc \
python3 \
curl \
ninja-build \
tar \
zip \
unzip \
zlib1g-dev \
libssl-dev \
wget \
&& apt-get autoclean \
&& apt-get autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN update-ca-certificates

COPY entrypoint.sh .
29 changes: 29 additions & 0 deletions .devcontainer/Dockerfile.arm64_vcpkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM arm64v8/ubuntu:22.04
SHELL ["/bin/bash", "-c"]

RUN apt-get update --fix-missing &&\
apt-get install -y --no-install-recommends build-essential ca-certificates cmake git g++ pkg-config python3 curl ninja-build tar zip unzip zlib1g-dev libssl-dev wget &&\
apt-get autoclean &&\
apt-get autoremove &&\
apt-get clean &&\
rm -rf /var/lib/apt/lists/*

RUN update-ca-certificates

RUN wget https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3.tar.gz &&\
tar -xzf cmake-3.28.3.tar.gz &&\
cd cmake-3.28.3 &&\
./configure &&\
make install &&\
cd .. &&\
rm cmake-3.28.3.tar.gz &&\
rm -r cmake-3.28.3

RUN git clone https://github.com/microsoft/vcpkg &&\
cd vcpkg &&\
git checkout 3b213864579b6fa686e38715508f7cd41a50900f &&\
export VCPKG_FORCE_SYSTEM_BINARIES=arm &&\
./bootstrap-vcpkg.sh -disableMetrics &&\
./vcpkg install grpc:arm64-linux &&\
./vcpkg install eigen3:arm64-linux &&\
./vcpkg install cli11:arm64-linux
13 changes: 13 additions & 0 deletions .devcontainer/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
ARCH=$(dpkg --print-architecture)

if [ "$ARCH" == "amd64" ]; then
docker build -t spot_builder -f Dockerfile.amd64 .
elif [ "$ARCH" == "arm64" ]; then
docker build -t spot_builder -f Dockerfile.arm64 .
else
echo "Unknown architecture: $ARCH" > /dev/stderr
exit 1
fi

docker run -v ~/spot-cpp-sdk:/spot-cpp-sdk spot_builder /entrypoint.sh
9 changes: 9 additions & 0 deletions .devcontainer/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
cd /spot-cpp-sdk/cpp
if [ -d build ]; then
rm -r build
fi
mkdir build
cd build
cmake .. -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=TRUE -DBUILD_CHOREOGRAPHY_LIBS=ON -DBUILD_SHARED_LIBS=ON
make -j8 install package
121 changes: 121 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Commented out due to speed of runners. Uncomment when we get the better ones.

# # This workflow automatically releases binaries upon tagging.
# name: spot-cpp-sdk CD

# on:
# push:
# tags:
# - '*'

# concurrency:
# group: ${{ github.workflow }}-${{ github.ref }}
# cancel-in-progress: true

# env:
# REGISTRY: ghcr.io
# # github.repository as <account>/<repo>
# IMAGE_NAME: bdaiinstitute/spot_cpp_sdk_builder

# jobs:
# build-docker-image:
# permissions:
# contents: read
# packages: write
# # This is used to complete the identity challenge
# # with sigstore/fulcio when running outside of PRs.
# id-token: write
# strategy:
# fail-fast: false
# matrix:
# config:
# - { arch: "amd64" }
# - { arch: "arm64" }
# name: Build docker image for ${{ matrix.config.arch }}
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4

# - name: Set up QEMU # as virtualization is necessary to build container images
# uses: docker/setup-qemu-action@v3

# - name: Setup Docker buildx # to workaround: https://github.com/docker/build-push-action/issues/461
# uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf

# - name: Log into registry ${{ env.REGISTRY }}
# uses: docker/login-action@v3 # https://github.com/docker/login-action
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}

# # Extract metadata (tags, labels) for Docker
# # https://github.com/docker/metadata-action
# - name: Extract Docker metadata
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}_${{ matrix.config.arch }}

# - name: Build and push
# uses: docker/build-push-action@v5 # https://github.com/docker/build-push-action
# id: build
# with:
# context: .
# file: .devcontainer/Dockerfile.${{ matrix.config.arch }}
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
# push: true

# build-artifacts:
# strategy:
# fail-fast: false
# matrix:
# config:
# - { arch: "amd64" }
# - { arch: "arm64" }
# name: Build spot-cpp-sdk for ${{ matrix.config.arch }}
# # needs: build-docker-image
# runs-on: ubuntu-latest
# container:
# # env cannot be used here...
# image: ghcr.io/bdaiinstitute/spot_cpp_sdk_builder_${{ matrix.config.arch }}:latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4

# - name: Build spot-sdk-cpp
# run: |
# cd spot-sdk-cpp/cpp
# mkdir build
# cd build
# cmake ../ -DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=TRUE -DBUILD_CHOREOGRAPHY_LIBS=ON
# make -j2 install package

# - name: Upload ${{ matrix.config.arch }} artifact
# uses: actions/upload-artifact@v4
# with:
# name: ${{ matrix.config.arch }}-artifact
# path: '*.deb'
# retention-days: 1

# bundle-debians:
# name: Release artifacts
# runs-on: ubuntu-latest
# needs: build-artifacts
# steps:
# - name: Download artifacts
# uses: actions/download-artifact@v4
# with:
# pattern: '*-artifact'
# merge-multiple: true

# - name: Release to GitHub
# uses: softprops/action-gh-release@v1
# with:
# name: Release ${{ github.ref_name }}
# files: '*.deb'

1 change: 1 addition & 0 deletions cpp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
Loading