-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
62 lines (50 loc) · 1.48 KB
/
Dockerfile
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
# Use an official Ubuntu runtime as a parent image
FROM ubuntu:24.04
# Set environment variable for vcpkg
ENV VCPKG_FORCE_SYSTEM_BINARIES=1
# Install necessary packages and LLVM/Clang 19
RUN apt-get update && \
apt-get install -y \
clang \
cmake \
git \
curl \
zip \
unzip \
tar \
ninja-build \
pkg-config \
make \
autoconf \
autoconf-archive \
wget \
gnupg \
software-properties-common \
lsb-release && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set Clang++ as the default C++ compiler
ENV CC=clang
ENV CXX=clang++
# Set the working directory
WORKDIR /app
# Install vcpkg first (this rarely changes)
RUN git clone https://github.com/microsoft/vcpkg.git && \
./vcpkg/bootstrap-vcpkg.sh
# Copy only vcpkg.json first to leverage layer caching for dependencies
COPY vcpkg.json .
# Install dependencies using vcpkg manifest
RUN ./vcpkg/vcpkg install --feature-flags=manifests
# Copy CMake files next (these change less frequently than source code)
COPY CMakeLists.txt .
# Copy the rest of the source code
COPY . .
# Remove dist and build directories if they exist
RUN rm -rf dist build
# Build the application using CMake with Clang++
RUN mkdir build && \
cd build && \
cmake -DCMAKE_TOOLCHAIN_FILE=/app/vcpkg/scripts/buildsystems/vcpkg.cmake .. && \
make
# Set the default command to run when the container starts
CMD ["/app/dist/CaveMUDServer"]