xref: /aosp_15_r20/external/stg/Dockerfile (revision 9e3b08ae94a55201065475453d799e8b1378bea6)
1# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2#
3# Copyright 2022-2023 Google LLC
4#
5# Licensed under the Apache License v2.0 with LLVM Exceptions (the "License");
6# you may not use this file except in compliance with the License.  You may
7# obtain a copy of the License at
8#
9# https://llvm.org/LICENSE.txt
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations under
15# the License.
16#
17# Author: Vanessa Sochat
18# Author: Aleksei Vetrov
19
20ARG debian_version=stable-slim
21FROM debian:${debian_version} as builder
22# docker build -t stg .
23RUN apt-get update && \
24    apt-get install -y \
25        build-essential \
26        pkg-config \
27        cmake \
28        libelf-dev \
29        libdw-dev \
30        libxml2-dev \
31        libprotobuf-dev \
32        protobuf-compiler \
33        libjemalloc-dev
34WORKDIR /src
35COPY . /src
36RUN mkdir -p build && \
37    cd build && \
38    cmake -DCMAKE_BUILD_TYPE=Release .. && \
39    cmake --build . --parallel && \
40    cmake --install . --strip
41# second stage
42FROM debian:${debian_version}
43RUN apt-get update && \
44    apt-get install -y \
45        libc6 \
46        libgcc-s1 \
47        libstdc++6 \
48        libdw1 \
49        libelf1 \
50        libjemalloc2 \
51        libprotobuf32 \
52        libxml2 && \
53    rm -rf /var/lib/apt/lists/*
54COPY --from=builder /usr/local /usr/local
55