WIP some more optimizations in the docker process. Preparing the dev container, using arguments.
This commit is contained in:
parent
ca820ff108
commit
3f22f888d6
|
|
@ -1,8 +1,12 @@
|
|||
{
|
||||
"name": "C++",
|
||||
"name": "4beumer.nl C++",
|
||||
"build": {
|
||||
"dockerfile": "../devcontainer.Dockerfile"
|
||||
"dockerfile": "../devcontainer.Dockerfile",
|
||||
"args": {
|
||||
"BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
"postCreateCommand": "${containerWorkspaceFolder}/.devcontainer/postcreate.py --build_type=Debug",
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
|
|
@ -14,6 +18,7 @@
|
|||
},
|
||||
"extensions": [
|
||||
"ms-vscode.cpptools",
|
||||
"ms-python.python",
|
||||
"twxs.cmake",
|
||||
"ms-vscode.cmake-tools",
|
||||
"konicy.conan-extension"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
#! /usr/bin/python
|
||||
import argparse
|
||||
import os
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--build_type')
|
||||
args = parser.parse_args()
|
||||
|
||||
print ('Executing post-create steps. Build type ', args.build_type)
|
||||
os.system('conan install /workspaces/network-experiment -of /workspaces/build -s build_type=' + args.build_type)
|
||||
|
|
@ -1,5 +1,12 @@
|
|||
FROM alpine:3.21.3 AS build
|
||||
FROM alpine:3.21.3
|
||||
|
||||
# Build type used by conan. "Debug" and "Release" are supported.
|
||||
ARG BUILD_TYPE=Debug
|
||||
|
||||
RUN mkdir -p /root/.local/bin
|
||||
ENV PATH="${PATH}:/root/.local/bin"
|
||||
|
||||
# Install packages needed in both building and running.
|
||||
RUN apk update && \
|
||||
apk add --no-cache \
|
||||
libstdc++
|
||||
|
|
@ -20,23 +27,25 @@ RUN apk add --no-cache \
|
|||
m4 \
|
||||
perl \
|
||||
python3 \
|
||||
py3-pip && \
|
||||
pip install --break-system-packages conan && \
|
||||
pipx && \
|
||||
pipx ensurepath
|
||||
RUN pipx install conan && \
|
||||
conan profile detect
|
||||
|
||||
# Pre-build some conan packages we require and take a lot of time to build. This to
|
||||
# avoid expensive rebuilding everytime we need a fresh dev container..
|
||||
RUN mkdir -p /workspaces/tmp
|
||||
WORKDIR /workspaces/tmp
|
||||
RUN conan install -s build_type=Debug -b=* --requires=boost/1.89.0
|
||||
RUN conan install -s build_type=Debug -b=* --requires=libmagic/5.45
|
||||
RUN conan install -s build_type=Debug -b=* --requires=freetype/2.14.1
|
||||
RUN conan install -s build_type=Debug -b=missing --requires=gtest/1.14.0
|
||||
RUN conan install -s build_type=Debug -b=missing --requires=libjpeg/9f
|
||||
|
||||
# Remove the temporary workspace, build results for the conan packages remain cached.
|
||||
RUN conan install -s build_type=${BUILD_TYPE} -b=* --requires=boost/1.89.0
|
||||
RUN conan install -s build_type=${BUILD_TYPE} -b=* --requires=libmagic/5.45
|
||||
RUN conan install -s build_type=${BUILD_TYPE} -b=* --requires=freetype/2.14.1
|
||||
RUN conan install -s build_type=${BUILD_TYPE} -b=missing --requires=gtest/1.14.0
|
||||
RUN conan install -s build_type=${BUILD_TYPE} -b=missing --requires=libjpeg/9f
|
||||
WORKDIR /workspaces
|
||||
RUN rm -rf tmp && \
|
||||
mkdir network-experiment && \
|
||||
mkdir build && \
|
||||
mkdir install
|
||||
RUN rm -rf tmp
|
||||
|
||||
RUN apk add --no-cache \
|
||||
clang \
|
||||
clang-extra-tools \
|
||||
gdb \
|
||||
git
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
FROM alpine:3.21.3 AS build
|
||||
|
||||
# Build type used by conan. "Debug" and "Release" are supported.
|
||||
ARG BUILD_TYPE=Release
|
||||
|
||||
RUN mkdir -p /root/.local/bin
|
||||
ENV PATH="${PATH}:/root/.local/bin"
|
||||
|
||||
# Install packages needed in both building and running.
|
||||
RUN apk update && \
|
||||
apk add --no-cache \
|
||||
libstdc++
|
||||
|
|
@ -20,19 +27,22 @@ RUN apk add --no-cache \
|
|||
m4 \
|
||||
perl \
|
||||
python3 \
|
||||
py3-pip && \
|
||||
pip install --break-system-packages conan && \
|
||||
pipx && \
|
||||
pipx ensurepath
|
||||
RUN pipx install conan && \
|
||||
conan profile detect
|
||||
|
||||
# Pre-build some conan packages we require and take a lot of time to build. This to
|
||||
# avoid expensive rebuilding everytime we need a fresh dev container..
|
||||
RUN mkdir -p /workspaces/tmp
|
||||
WORKDIR /workspaces/tmp
|
||||
RUN conan install -s build_type=Release -b=* --requires=boost/1.89.0
|
||||
RUN conan install -s build_type=Release -b=* --requires=libmagic/5.45
|
||||
RUN conan install -s build_type=Release -b=* --requires=freetype/2.14.1
|
||||
RUN conan install -s build_type=Release -b=missing --requires=gtest/1.14.0
|
||||
RUN conan install -s build_type=Release -b=missing --requires=libjpeg/9f
|
||||
RUN conan install -s build_type=${BUILD_TYPE} -b=* --requires=boost/1.89.0
|
||||
RUN conan install -s build_type=${BUILD_TYPE} -b=* --requires=libmagic/5.45
|
||||
RUN conan install -s build_type=${BUILD_TYPE} -b=* --requires=freetype/2.14.1
|
||||
RUN conan install -s build_type=${BUILD_TYPE} -b=missing --requires=gtest/1.14.0
|
||||
RUN conan install -s build_type=${BUILD_TYPE} -b=missing --requires=libjpeg/9f
|
||||
WORKDIR /workspaces
|
||||
RUN rm -rf tmp
|
||||
|
||||
# Remove the temporary workspace, build results for the conan packages remain cached.
|
||||
WORKDIR /workspaces
|
||||
|
|
@ -41,16 +51,16 @@ RUN rm -rf tmp && \
|
|||
mkdir build && \
|
||||
mkdir install
|
||||
|
||||
|
||||
# Build and install
|
||||
WORKDIR /workspaces/network-experiment
|
||||
ADD . .
|
||||
RUN conan install /workspaces/network-experiment -of /workspaces/build -s build_type=Release
|
||||
RUN cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -S . -B /workspaces/build --install-prefix=/workspaces/install
|
||||
RUN conan install /workspaces/network-experiment -of /workspaces/build -s build_type=${BUILD_TYPE}
|
||||
RUN cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -S . -B /workspaces/build --install-prefix=/workspaces/install
|
||||
RUN cmake --build /workspaces/build --parallel
|
||||
RUN cmake --install /workspaces/build
|
||||
|
||||
|
||||
|
||||
FROM alpine:3.21.3
|
||||
|
||||
RUN apk update && \
|
||||
|
|
|
|||
Loading…
Reference in New Issue