Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
62 lines (49 loc) · 2.19 KB
/
Copy pathDockerfile
File metadata and controls
62 lines (49 loc) · 2.19 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
#==================== Build stage ====================
FROM --platform=linux/amd64 rust:1.90.0-bookworm as builder
# Disable Rosetta and force QEMU emulation
ENV DOCKER_DEFAULT_PLATFORM=linux/amd64
# Replace Debian package sources with faster mirrors
RUN sed -i 's|http://deb.debian.org|http://mirrors.ustc.edu.cn|g' /etc/apt/sources.list.d/debian.sources && \
sed -i 's|http://security.debian.org|http://mirrors.ustc.edu.cn|g' /etc/apt/sources.list.d/debian.sources
# Install vcpkg dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git build-essential cmake make zip unzip tar curl \
pkg-config autoconf automake libtool linux-libc-dev libgl1-mesa-dev \
&& rm -rf /var/lib/apt/lists/*
# Install vcpkg
WORKDIR /opt
RUN git clone https://gitee.com/Wallance/vcpkg.git && \
./vcpkg/bootstrap-vcpkg.sh
# Install OpenGL related dependencies (as in GitHub workflow)
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1-mesa-dev libglu1-mesa-dev \
libx11-dev libxrandr-dev libxi-dev libxxf86vm-dev \
&& rm -rf /var/lib/apt/lists/*
# Set environment variables for vcpkg
ENV VCPKG_ROOT=/opt/vcpkg
ENV PATH=$VCPKG_ROOT:$PATH
# Copy source code
WORKDIR /app
COPY . .
# Build the project
ENV CARGO_TERM_COLOR=always
RUN cargo build --release -vv
#==================== Runtime stage ====================
FROM debian:bookworm-slim
# Replace Debian package sources with faster mirrors
RUN sed -i 's|http://deb.debian.org|http://mirrors.ustc.edu.cn|g' /etc/apt/sources.list.d/debian.sources && \
sed -i 's|http://security.debian.org|http://mirrors.ustc.edu.cn|g' /etc/apt/sources.list.d/debian.sources
RUN mkdir -p /3dtiles
WORKDIR /3dtiles
# Copy executables
COPY --from=builder /app/target/release/_3dtile /3dtiles/_3dtile
COPY --from=builder /app/target/release/gdal /3dtiles/gdal
COPY --from=builder /app/target/release/proj /3dtiles/proj
# Copy OSG plugins for runtime loading
COPY --from=builder /app/target/release/osgPlugins-3.6.5 /3dtiles/osgPlugins-3.6.5
# Set environment variables for runtime
ENV OSG_LIBRARY_PATH=/3dtiles/osgPlugins-3.6.5
ENV GDAL_DATA=/3dtiles/gdal
ENV PROJ_DATA=/3dtiles/proj
WORKDIR /data
ENTRYPOINT ["/3dtiles/_3dtile", "--help"]