-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
73 lines (60 loc) · 2.06 KB
/
Copy pathDockerfile
File metadata and controls
73 lines (60 loc) · 2.06 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
FROM ubuntu:24.04 AS builder
ARG DEBIAN_FRONTEND=noninteractive
ARG VCPKG_COMMIT=55fab67aea1027f7179ae6b5c54a5ba9091c16aa
ARG BUILD_JOBS=4
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
autoconf \
automake \
bison \
build-essential \
ca-certificates \
ccache \
curl \
flex \
g++-14 \
git \
libtool \
ninja-build \
perl \
pkg-config \
python3 \
python3-venv \
tar \
unzip \
zip \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m venv /opt/cmake \
&& /opt/cmake/bin/pip install --no-cache-dir cmake==4.0.3
RUN git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg \
&& git -C /opt/vcpkg checkout "${VCPKG_COMMIT}" \
&& /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics
ENV CC=gcc-14 \
CXX=g++-14 \
PATH="/opt/cmake/bin:${PATH}" \
VCPKG_ROOT=/opt/vcpkg \
VCPKG_DEFAULT_TRIPLET=x64-linux
WORKDIR /workspace
COPY . .
RUN cmake -S . -B build/container -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=g++-14 \
-DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake \
&& cmake --build build/container --target disk --parallel "${BUILD_JOBS}"
FROM ubuntu:24.04 AS runtime
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl libgcc-s1 libstdc++6 postgresql-client \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd --gid 10001 disk-app \
&& useradd --uid 10001 --gid disk-app --create-home --home-dir /var/lib/disk --shell /usr/sbin/nologin disk
COPY --from=builder /workspace/build/container/src/disk /app/disk
COPY deploy/config.distributed.json /app/config.json
COPY scripts/migrate-db.sh /app/scripts/migrate-db.sh
COPY sql/migrations/manifest.tsv sql/migrations/*_forward.sql /app/sql/migrations/
RUN chmod 0555 /app/scripts/migrate-db.sh \
&& chown -R disk:disk-app /app /var/lib/disk
USER 10001:10001
WORKDIR /app
EXPOSE 8080
ENTRYPOINT ["/app/disk"]