Repository navigation
Expand file tree
/
Copy pathDockerfile.deps
More file actions
64 lines (52 loc) · 2.66 KB
/
Copy pathDockerfile.deps
File metadata and controls
64 lines (52 loc) · 2.66 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
# Dependencies-only image for faster CI builds
# This image pre-compiles all Haskell dependencies
# Rebuilt weekly or when cabal files change
# Bump in lockstep with cabal.project's `with-compiler: ghc-X.Y.Z`.
ARG GHC_VERSION=9.12.2
FROM haskell:${GHC_VERSION}
# Install system dependencies (combined into single layer)
RUN apt-get update && apt-get install -y \
curl ca-certificates lsb-release gnupg \
libssl-dev librdkafka-dev libsnappy-dev libgrpc-dev \
libpq-dev libldap2-dev libsasl2-dev liblz4-dev libzstd-dev \
pkg-config git wget unzip \
&& curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/postgresql-keyring.gpg] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update && apt-get install -y postgresql-client-16 \
&& rm -rf /var/lib/apt/lists/*
# Install protoc
RUN PROTOC_VERSION=29.3 && \
ARCH=$(dpkg --print-architecture | sed 's/arm64/aarch_64/;s/amd64/x86_64/') && \
wget -q https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${ARCH}.zip && \
unzip -q protoc-${PROTOC_VERSION}-linux-${ARCH}.zip -d /usr/local && \
rm protoc-${PROTOC_VERSION}-linux-${ARCH}.zip
# Install Node.js and bun for frontend builds
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
apt-get install -y nodejs && \
npm install -g bun workbox-cli@6.5.4 && \
rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Fix cabal state to a known path so GHA containers (which override HOME) can find it
ENV CABAL_DIR=/root/.cabal
# Copy only files needed for dependency resolution
COPY *.cabal cabal.project* Setup.hs LICENSE ./
# Update cabal index and build all dependencies (including test deps)
RUN cabal update && \
cabal configure --enable-tests --enable-benchmarks && \
cabal build --only-dependencies all -j$(nproc)
# Pre-install npm dependencies for faster deploys
COPY package*.json ./
RUN npm ci --prefer-offline --no-audit
COPY web-components/package*.json ./web-components/
RUN cd web-components && npm ci --prefer-offline --no-audit
# Build chart-cli (pre-compiled for faster deployments)
COPY web-components ./web-components
RUN cd web-components && bun build --compile src/chart-cli.ts --outfile /usr/local/bin/chart-cli && \
chmod +x /usr/local/bin/chart-cli
# The resulting image contains:
# - All system libraries
# - GHC (from ARG GHC_VERSION above)
# - protoc
# - Node.js, bun, workbox-cli, and pre-built chart-cli
# - All npm dependencies pre-installed
# - All Haskell dependencies pre-compiled in ~/.cabal/store