-
-
Notifications
You must be signed in to change notification settings - Fork 104
Expand file tree
/
Copy pathDockerfile
More file actions
96 lines (79 loc) · 2.85 KB
/
Dockerfile
File metadata and controls
96 lines (79 loc) · 2.85 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
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
# Image used as runtime base for a game server.
# Contains a minimal subset of stuff needed for running (and debugging, if needed) the server.
FROM ubuntu:25.10 AS skymp-runtime-base
# Prevent apt-get from asking us about timezone
# London is not always UTC+0:00
ENV TZ=Etc/GMT
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN \
apt-get update && apt-get install -y curl \
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get update \
&& apt-get install -y nodejs gdb \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m skymp
# This is the base image for building SkyMP source.
# It contains everything that should be installed on the system.
FROM skymp-runtime-base AS skymp-build-base
# TODO: update clang
RUN \
curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor > /usr/share/keyrings/yarnkey.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" > /etc/apt/sources.list.d/yarn.list \
&& curl -fsSL https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --dearmor - > /usr/share/keyrings/kitware-archive-keyring.gpg \
&& echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' > /etc/apt/sources.list.d/kitware.list \
&& apt-get update \
&& apt-get install -y \
nodejs \
yarn \
libicu-dev \
git \
cmake \
curl \
unzip \
tar \
make \
zip \
pkg-config \
flex \
bison \
autoconf \
autoconf-archive \
automake \
libtool \
cmake \
clang-20 \
clang-format-20 \
ninja-build \
build-essential \
&& rm -rf /var/lib/apt/lists/*
RUN ln -s /usr/bin/clang-20 /usr/bin/clang \
&& ln -s /usr/bin/clang++-20 /usr/bin/clang++ \
&& ln -s /usr/bin/clang-cpp-20 /usr/bin/clang-cpp
# Intermediate image to build
# TODO: copy less stuff
# TODO: build huge deps separately
FROM skymp-build-base AS skymp-vcpkg-deps-builder
ARG VCPKG_URL
ARG VCPKG_COMMIT
# 1. Set the working directory
WORKDIR /src
# 2. Copy files and set ownership of the copied files
COPY --chown=skymp:skymp . .
# 3. Explicitly fix ownership of the /src directory itself
# This ensures skymp can create new folders (like 'vcpkg') inside it
USER root
RUN chown skymp:skymp /src
# 4. Now switch to the non-root user
USER skymp
# 5. Run the build commands
RUN git clone "$VCPKG_URL" vcpkg \
&& git -C vcpkg checkout "$VCPKG_COMMIT" \
&& chmod +x build.sh \
&& sed -i 's/\r$//' build.sh \
&& ./build.sh --configure
# Image that runs in CI. It contains vcpkg cache to speedup the build.
# Sadly, the builtin NuGet cache doesn't work on Linux, see:
# https://github.com/microsoft/vcpkg/issues/19038
FROM skymp-build-base AS skymp-vcpkg-deps
COPY --from=skymp-vcpkg-deps-builder --chown=skymp:skymp \
/home/skymp/.cache/vcpkg /home/skymp/.cache/vcpkg