-
Notifications
You must be signed in to change notification settings - Fork 38
/
Dockerfile
87 lines (65 loc) · 1.83 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
# syntax=docker/dockerfile:1
ARG BASE_IMAGE=ubuntu:24.04
FROM ${BASE_IMAGE} AS builder
RUN apt update && apt install -y --no-install-recommends \
python3 \
git \
ca-certificates \
sudo \
make \
cmake \
g++ \
libevent-dev \
zlib1g-dev
# ---
FROM builder AS deps
ARG PHOSG_TARGET=master
ARG RESOURCE_DASM_TARGET=master
ARG BUILD_RESOURCE_DASM=true
RUN git clone --depth 1 -b ${PHOSG_TARGET} https://github.com/fuzziqersoftware/phosg.git && \
cd phosg && \
cmake . && \
make -j$(nproc) && \
sudo make install
RUN \
if [ "$BUILD_RESOURCE_DASM" = "true" ] ; then \
git clone --depth 1 -b ${RESOURCE_DASM_TARGET} https://github.com/fuzziqersoftware/resource_dasm.git && \
cd resource_dasm && \
cmake . && \
make -j$(nproc) && \
sudo make install \
; fi
# ---
FROM builder AS newserv
ARG BUILD_TYPE=Release
ARG BUILD_STRIP=true
WORKDIR /usr/src/newserv
COPY . .
COPY --from=deps /usr/local /usr/local
RUN cmake -B $PWD/build -DCMAKE_BUILD_TYPE=${BUILD_TYPE} && \
cmake --build $PWD/build --config ${BUILD_TYPE} -j $(nproc) && \
sudo make -C build install
RUN \
if [ "$BUILD_STRIP" = "true" ] ; then \
strip /usr/local/lib/*.a && \
strip /usr/local/bin/* \
; fi
# ---
FROM ${BASE_IMAGE} AS data
WORKDIR /newserv
COPY system/ ./system
RUN cp -f system/config.example.json system/config.json && \
sed -i 's/"ExternalAddress": "[^"]*"/"ExternalAddress": "0.0.0.0"/' system/config.json
# ---
FROM ${BASE_IMAGE} AS final
RUN apt update && apt install -y --no-install-recommends \
libevent-dev \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
WORKDIR /newserv
COPY --from=data /newserv .
COPY --from=newserv /usr/local /usr/local
USER root
VOLUME /newserv/system
# does not allow receiving any signal at the moment, so force kill the app
STOPSIGNAL SIGKILL
CMD ["newserv"]