-
Notifications
You must be signed in to change notification settings - Fork 113
Expand file tree
/
Copy pathDockerfile
More file actions
74 lines (62 loc) · 2.32 KB
/
Dockerfile
File metadata and controls
74 lines (62 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM ubuntu:24.04 AS base
# Create separate targets for each phase, this allows us to cache intermediate
# stages when using Google Cloud Build, and makes the final deployment stage
# small as it contains only what is needed.
FROM base AS devtools
# Install the typical development tools and some additions:
# - ninja-build is a backend for CMake that often compiles faster than
# CMake with GNU Make.
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && \
apt install -y \
build-essential \
cmake \
curl \
gcc \
g++ \
git \
ninja-build \
pkg-config \
python3 \
tar \
unzip \
zip
# Copy the source code to /v/source and compile it.
FROM devtools AS build
WORKDIR /v/vcpkg
RUN curl -sSL "https://github.com/Microsoft/vcpkg/archive/2026.03.18.tar.gz" | \
tar --strip-components=1 -zxf - \
&& ./bootstrap-vcpkg.sh -disableMetrics
COPY vcpkg.json /v/deps/
RUN /v/vcpkg/vcpkg install --x-manifest-root=/v/deps --clean-after-build
# Run the CMake configuration step.
COPY . /v/source
RUN cmake -S/v/source -B/v/binary -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=/v/vcpkg/scripts/buildsystems/vcpkg.cmake \
&& cmake --build /v/binary --target gke_index_gcs \
&& strip /v/binary/gke_index_gcs
# Create the final deployment image, install the minimal dependencies for the
# program.
FROM base AS getting-started-gke
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && \
apt-get --no-install-recommends install -y libstdc++6 ca-certificates && \
rm -rf /var/cache/apt/*
WORKDIR /r
# Copy the program from the previously created stage and make it the entry point.
COPY --from=build /v/binary/gke_index_gcs /r
ENTRYPOINT [ "/r/gke_index_gcs" ]