1- FROM python:3.11-slim
1+ FROM debian:stable-slim AS splat
2+ RUN apt update && apt install -y cmake make clang zlib1g-dev libbz2-dev git && rm -rf /var/lib/apt/lists/*
23
4+ COPY splat/ /splat/
5+
6+ WORKDIR /splat/build/
7+ RUN cmake .. && make
8+ RUN ln -sf splat splat-hd
9+
10+ WORKDIR /splat/utils/build/
11+ RUN cmake .. && make
12+
13+ FROM node:20-slim AS ui
14+ ENV PNPM_HOME="/pnpm"
15+ ENV PATH="$PNPM_HOME:$PATH"
16+ RUN corepack enable
17+
18+ COPY package.json pnpm-lock.yaml /app/
19+ WORKDIR /app
20+
21+ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
22+ COPY index.html tsconfig*json vite.config.ts /app/
23+ COPY src/ /app/src
24+ COPY public/ /app/public
25+
26+ RUN pnpm run build
27+
28+ FROM python:3.12-slim
329ENV HOME="/root"
430ENV TERM=xterm
531
6- # Install system dependencies first (before Python dependencies)
7- RUN apt-get update && apt-get install -y \
8- build-essential \
9- libbz2-dev \
10- gdal-bin \
11- libgdal-dev \
12- && apt-get clean
32+ RUN apt update && apt install -y libexpat-dev && rm -rf /var/lib/apt/lists/*
1333
1434# Set the working directory
1535WORKDIR /app
1636
1737# Copy requirements first to leverage Docker caching
18- COPY requirements.txt /app/
38+ COPY requirements.txt .
1939
2040# Install Python dependencies
2141RUN pip install --no-cache-dir -r requirements.txt
2242
2343# Copy the rest of the application files
24- COPY . .
44+ COPY app/ app/
2545
26- # Change to SPLAT directory and set permissions
27- WORKDIR /app/splat
28- RUN chmod +x build && chmod +x configure && chmod +x install
46+ # Copy UI build from the previous stage
47+ COPY --from=ui /app/app/ui/ app/ui/
2948
30- # Modify build script and configure SPLAT
31- RUN sed -i.bak 's/-march=\$ cpu/-march=native/g' build && \
32- printf "8\n 4\n " | ./configure && \
33- ./install splat
34- # RUN cp ./splat /app/splat
49+ # Copy SPLAT build from the previous stage
50+ COPY --from=splat /splat/build/splat /splat/build/splat-hd /splat/utils/build/srtm2sdf* splat/
3551
36- # SPLAT utils including srtm2sdf
37- WORKDIR /app/splat/utils
38- RUN chmod +x build
39- RUN ./build all && cp srtm2sdf /app && cp srtm2sdf-hd /app
40- RUN cp -a ./ /app/splat
41-
42- WORKDIR /app
43- RUN chmod +x /app/splat/splat
44- RUN chmod +x /app/splat/srtm2sdf
45- RUN chmod +x /app/splat/citydecoder
46- RUN chmod +x /app/splat/bearing
47- RUN chmod +x /app/splat/fontdata
48- RUN chmod +x /app/splat/usgs2sdf
49- RUN ls -alh
5052# Expose the application port
51- EXPOSE 8080
53+ EXPOSE 8080
0 commit comments