|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +FROM docker.io/library/ubuntu:24.04@sha256:2e863c44b718727c860746568e1d54afd13b2fa71b160f5cd9058fc436217b30 as build |
| 19 | + |
| 20 | +# Install dependencies |
| 21 | +RUN DEBIAN_FRONTEND="noninteractive" apt-get update && \ |
| 22 | + DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \ |
| 23 | + build-essential \ |
| 24 | + ccache \ |
| 25 | + cmake \ |
| 26 | + gcc \ |
| 27 | + g++ \ |
| 28 | + make \ |
| 29 | + zip \ |
| 30 | + ninja-build \ |
| 31 | + lcov \ |
| 32 | + sudo \ |
| 33 | + python3 \ |
| 34 | + pipx && \ |
| 35 | + apt-get clean |
| 36 | + |
| 37 | +#python3-pip && \ |
| 38 | + |
| 39 | +# Build image using conan & cmake |
| 40 | +FROM build as conan-build |
| 41 | + |
| 42 | +# Install conan |
| 43 | +#RUN pip3 install conan && pip3 cache purge |
| 44 | +##RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \ |
| 45 | +# python3-conan && \ |
| 46 | +# apt-get clean |
| 47 | +ENV PATH="${PATH}:/root/.local/bin" |
| 48 | +RUN pipx install conan |
| 49 | + |
| 50 | +# Setup conan profile for root |
| 51 | +COPY conan-container-default-profile /root/.conan2/profiles/default |
| 52 | +COPY conan-container-debug-profile /root/.conan2/profiles/debug |
| 53 | + |
| 54 | +# Build image using apt dependencies |
| 55 | +FROM build as apt-build |
| 56 | + |
| 57 | +# Install celix dependencies (note git needed for cloning gtest) |
| 58 | +RUN DEBIAN_FRONTEND="noninteractive" sudo apt-get update && \ |
| 59 | + DEBIAN_FRONTEND="noninteractive" sudo apt-get install -y --no-install-recommends \ |
| 60 | + git \ |
| 61 | + civetweb \ |
| 62 | + libavahi-compat-libdnssd-dev \ |
| 63 | + libcivetweb-dev \ |
| 64 | + libcpputest-dev \ |
| 65 | + libcurl4-openssl-dev \ |
| 66 | + libczmq-dev \ |
| 67 | + libffi-dev \ |
| 68 | + libjansson-dev \ |
| 69 | + libxml2-dev \ |
| 70 | + libzip-dev \ |
| 71 | + rapidjson-dev \ |
| 72 | + uuid-dev && \ |
| 73 | + sudo apt-get clean |
| 74 | + |
| 75 | +#Note from build not conan-build, because conan-dev uses a celixdev user |
| 76 | +FROM build as conan-dev |
| 77 | + |
| 78 | +# Remove ubuntu user and add celixdev with sudo rights and a "celixdev" password |
| 79 | +RUN userdel -r ubuntu && \ |
| 80 | + groupadd --gid 1000 celixdev && \ |
| 81 | + useradd --uid 1000 --gid 1000 -m \ |
| 82 | + -s /bin/bash -G sudo celixdev && \ |
| 83 | + echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \ |
| 84 | + echo "celixdev:celixdev" | chpasswd |
| 85 | +USER celixdev |
| 86 | +WORKDIR /home/celixdev |
| 87 | + |
| 88 | +#Create workdir, used in vscode |
| 89 | +#RUN sudo mkdir -p /workspaces/celix/build && sudo chown -R celixdev:celixdev /workspaces |
| 90 | + |
| 91 | +# Setup python venv for celixdev and install conan |
| 92 | +ENV PATH="${PATH}:/home/celixdev/.local/bin" |
| 93 | +RUN pipx install conan |
| 94 | + |
| 95 | +# Setup conan profile for celixdev |
| 96 | +COPY --chown=celixdev:celixdev conan-container-default-profile /home/celixdev/.conan2/profiles/default |
| 97 | +COPY --chown=celixdev:celixdev conan-container-debug-profile /home/celixdev/.conan2/profiles/debug |
| 98 | + |
| 99 | +#Install development dependencies |
| 100 | +RUN sudo DEBIAN_FRONTEND="noninteractive" apt-get update && \ |
| 101 | + sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \ |
| 102 | + gnupg2 dos2unix git locales-all rsync tar ssh tzdata sudo vim openssh-server cmake-curses-gui gdb \ |
| 103 | + wget curl && \ |
| 104 | + sudo apt-get clean |
| 105 | + |
| 106 | +RUN sudo mkdir /run/sshd |
| 107 | + |
| 108 | +FROM apt-build as apt-dev |
| 109 | + |
| 110 | +# Remove ubuntu user and add celixdev with sudo rights and a "celixdev" password |
| 111 | +RUN userdel -r ubuntu && \ |
| 112 | + groupadd --gid 1000 celixdev && \ |
| 113 | + useradd --uid 1000 --gid 1000 -m \ |
| 114 | + -s /bin/bash -G sudo celixdev && \ |
| 115 | + echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \ |
| 116 | + echo "celixdev:celixdev" | chpasswd |
| 117 | +USER celixdev |
| 118 | +WORKDIR /home/celixdev |
| 119 | + |
| 120 | +#Install development dependencies |
| 121 | +RUN sudo DEBIAN_FRONTEND="noninteractive" apt-get update && \ |
| 122 | + sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \ |
| 123 | + gnupg2 dos2unix git locales-all rsync tar ssh tzdata sudo vim openssh-server cmake-curses-gui gdb \ |
| 124 | + wget curl && \ |
| 125 | + sudo apt-get clean |
| 126 | + |
| 127 | +RUN sudo mkdir /run/sshd |
0 commit comments