forked from Monkestation/Monkestation2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
84 lines (67 loc) · 2.4 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
# base = ubuntu + full apt update
FROM ubuntu:xenial AS base
RUN dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get upgrade -y \
&& apt-get dist-upgrade -y \
&& apt-get install -y --no-install-recommends \
ca-certificates
# byond = base + byond installed globally
FROM base AS byond
WORKDIR /byond
RUN apt-get install -y --no-install-recommends \
curl \
unzip \
make \
libstdc++6:i386
COPY dependencies.sh .
RUN . ./dependencies.sh \
&& curl "http://www.byond.com/download/build/${BYOND_MAJOR}/${BYOND_MAJOR}.${BYOND_MINOR}_byond_linux.zip" -o byond.zip \
&& unzip byond.zip \
&& cd byond \
&& sed -i 's|install:|&\n\tmkdir -p $(MAN_DIR)/man6|' Makefile \
&& make install \
&& chmod 644 /usr/local/byond/man/man6/* \
&& apt-get purge -y --auto-remove curl unzip make \
&& cd .. \
&& rm -rf byond byond.zip
# build = byond + tgstation compiled and deployed to /deploy
FROM byond AS build
WORKDIR /tgstation
RUN apt-get install -y --no-install-recommends \
curl
COPY . .
RUN env TG_BOOTSTRAP_NODE_LINUX=1 tools/build/build \
&& tools/deploy.sh /deploy
# rust = base + rustc and i686 target
FROM base AS rust
RUN apt-get install -y --no-install-recommends \
curl && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal \
&& ~/.cargo/bin/rustup target add i686-unknown-linux-gnu
# rust_g = base + rust_g compiled to /rust_g
FROM rust AS rust_g
WORKDIR /rust_g
RUN apt-get install -y --no-install-recommends \
pkg-config:i386 \
libssl-dev:i386 \
gcc-multilib \
git \
&& git init \
&& git remote add origin https://github.com/tgstation/rust-g
COPY dependencies.sh .
RUN . ./dependencies.sh \
&& git fetch --depth 1 origin "${RUST_G_VERSION}" \
&& git checkout FETCH_HEAD \
&& env PKG_CONFIG_ALLOW_CROSS=1 ~/.cargo/bin/cargo build --release --target i686-unknown-linux-gnu
# final = byond + runtime deps + rust_g + build
FROM byond
WORKDIR /tgstation
RUN apt-get install -y --no-install-recommends \
libssl1.0.0:i386 \
zlib1g:i386
COPY --from=build /deploy ./
COPY --from=rust_g /rust_g/target/i686-unknown-linux-gnu/release/librust_g.so ./librust_g.so
VOLUME [ "/tgstation/config", "/tgstation/data" ]
ENTRYPOINT [ "DreamDaemon", "tgstation.dmb", "-port", "1337", "-trusted", "-close", "-verbose" ]
EXPOSE 1337