-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
169 lines (152 loc) · 9.36 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# CMake builder
FROM ubuntu:focal AS cmake-builder
# Install essential build tools
RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
git \
libssl-dev
# Clone and build CMake
ARG CMAKE_VER="v3.22.1"
RUN git clone https://github.com/Kitware/CMake \
--depth 1 \
--branch "${CMAKE_VER}" \
/tmp/cmake \
&& mkdir -p /tmp/cmake/build \
&& cd /tmp/cmake/build \
&& ../bootstrap --parallel=$(nproc) --prefix=/opt/cmake \
&& make -j$(nproc) \
&& make install \
&& rm -rf /tmp/cmake
# Vulkan SDK builder
FROM ubuntu:focal AS vulkan-sdk-builder
ENV DEBIAN_FRONTEND="noninteractive"
# Install CMake
COPY --from=cmake-builder /opt/cmake/ /usr/local/
# Install required packages
RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
# Essential build tools
build-essential \
ca-certificates \
git \
pkg-config \
python3 \
# Vulkan SDK dependencies
libx11-dev \
libxrandr-dev \
libwayland-dev \
xorg-dev
# Build and install Vulkan SDK
ARG VULKAN_SDK_VER="1.3.268.0"
COPY tools/install_vulkan_sdk_linux.sh /tmp/tools/install_vulkan_sdk_linux.sh
RUN bash /tmp/tools/install_vulkan_sdk_linux.sh \
"${VULKAN_SDK_VER}" \
"/opt/vulkan-sdk"
# Boost library builder
FROM ubuntu:focal AS boost-builder
# Install essential build tools
RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
wget
# Build and install Boost
COPY tools/install_boost_linux.sh /tmp/tools/install_boost_linux.sh
RUN bash /tmp/tools/install_boost_linux.sh "/opt/boost"
# Mono library builder
FROM ubuntu:focal AS mono-builder
ENV DEBIAN_FRONTEND="noninteractive"
# Install essential build tools
RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
autoconf \
automake \
build-essential \
ca-certificates \
cmake \
curl \
gettext \
git \
libtool \
python3
# Clone and build Mono
ARG MONO_VER="6000.0.9f1"
RUN git clone https://github.com/hogletgames/mono.git \
--branch "${MONO_VER}" \
--depth 1 \
/tmp/mono \
&& cd /tmp/mono \
&& ./autogen.sh --with-overridable-allocators --prefix=/opt/mono \
&& make get-monolite-latest \
&& make -j$(nproc) \
&& make install \
&& rm -rf /tmp/mono
# Genesis image
FROM ubuntu:focal AS genesis-image
ARG GCC_VER=11 \
CLANG_VER=19
ENV DEBIAN_FRONTEND="noninteractive"
# Install reuqired packages from previous stages
COPY --from=cmake-builder /opt/cmake/ /usr/local/
COPY --from=vulkan-sdk-builder /opt/vulkan-sdk /opt/vulkan-sdk
COPY --from=boost-builder /opt/boost /opt/boost
COPY --from=mono-builder /opt/mono /opt/mono
# Instal essential packages
RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
gpg-agent \
software-properties-common \
wget \
# GCC
&& apt-add-repository ppa:ubuntu-toolchain-r/test \
# Clang tools
&& wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& apt-add-repository \
"deb http://apt.llvm.org/focal/ llvm-toolchain-focal-${CLANG_VER} main"\
# Essential build tools
&& apt-get update && apt-get install -y --no-install-recommends \
build-essential \
gcc-${GCC_VER} \
g++-${GCC_VER} \
clang-format-${CLANG_VER} \
clang-tidy-${CLANG_VER} \
git \
patch \
libgtk-3-dev \
# Development tools
bash-completion \
gdb \
valgrind \
vim \
# Configure git
&& git config --add --system user.name "hogletgames" \
&& git config --add --system user.email "hogletgames@gmail.com" \
&& git config --add --system safe.directory "*"
# SDL2 dependencies
RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
libx11-dev \
libsamplerate-dev \
libasound2-dev \
libjack-dev \
libpulse-dev \
libsndio-dev \
libxcursor-dev \
libxinerama-dev \
libxi-dev \
libxrandr-dev \
libxss-dev \
libxxf86vm-dev \
libdbus-1-dev
# Environment
ENV PATH="/opt/mono/bin:${PATH}" \
PKG_CONFIG_PATH="/opt/mono/lib/pkgconfig" \
CC="gcc-${GCC_VER}" \
CXX="g++-${GCC_VER}" \
CLANG_FORMAT_BIN="clang-format-${CLANG_VER}" \
RUN_CLANG_TIDY_BIN="run-clang-tidy-${CLANG_VER}" \
VULKAN_SDK="/opt/vulkan-sdk" \
BOOST_ROOT="/opt/boost" \
MONO_PATH="/opt/mono/lib/mono/4.5"