-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (32 loc) · 967 Bytes
/
Dockerfile
File metadata and controls
41 lines (32 loc) · 967 Bytes
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
FROM gcc:15.2.0-trixie AS build
# 1 - Update base image
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
zip \
unzip \
tar \
ca-certificates \
cmake \
&& rm -rf /var/lib/apt/lists/*
# 2 - Setup Vcpkg
WORKDIR /usr
RUN git clone --depth 1 https://github.com/microsoft/vcpkg.git && ./vcpkg/bootstrap-vcpkg.sh
# 3 - add environment variables
ENV VCPKG_HOME=/usr/vcpkg
ENV PATH=$VCPKG_HOME:$PATH
# 4 - Prep build directory and get vcpkg packages
WORKDIR /usr/cppuserapi
COPY vcpkg.json ./
RUN vcpkg install
COPY . .
# 5 - build project
RUN chmod +x build.sh && ./build.sh
# Use this for small final size
FROM gcr.io/distroless/cc-debian13 AS app
# Use this for debugging
# FROM debian:trixie-slim AS app
WORKDIR /app
COPY --from=build /usr/cppuserapi/build/CppUserAPI .
COPY --from=build /usr/cppuserapi/cppuserapi_config.toml .
EXPOSE 3000
ENTRYPOINT ["./CppUserAPI"]