-
-
Notifications
You must be signed in to change notification settings - Fork 658
/
Copy pathDockerfile.dev
40 lines (34 loc) · 1.27 KB
/
Dockerfile.dev
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
# Stage 1: Download all dependencies
FROM ubuntu:24.04 AS dependencies
RUN --mount=type=cache,target=/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends cmake git \
unzip build-essential ca-certificates curl zip unzip tar \
pkg-config ninja-build autoconf automake libtool glibc-tools \
python3 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /opt
COPY vcpkg.json /opt
RUN vcpkgCommitId=$(grep '.builtin-baseline' vcpkg.json | awk -F: '{print $2}' | tr -d '," ' | tr -d '\r\n') \
&& echo "vcpkg commit ID: '$vcpkgCommitId'" \
&& git clone https://github.com/microsoft/vcpkg.git \
&& cd vcpkg \
&& git fetch origin \
&& git checkout "$vcpkgCommitId" \
&& ./bootstrap-vcpkg.sh
WORKDIR /opt/vcpkg
COPY vcpkg.json /opt/vcpkg/
RUN --mount=type=cache,target=/var/cache/vcpkg \
/opt/vcpkg/vcpkg --feature-flags=binarycaching,manifests,versions install
# Stage 2: create build
FROM dependencies AS build
WORKDIR /srv/build
COPY src ./src
COPY cmake ./cmake
COPY recompile.sh CMakeLists.txt CMakePresets.json vcpkg.json ./
RUN ./recompile.sh "/opt"
# Stage 3: execute
FROM ubuntu:24.04 AS prod
COPY --from=build /srv/build/build/linux-release/bin/canary /bin/canary
WORKDIR /srv/canary
ENTRYPOINT ["/srv/canary/start.sh", "canary"]