Skip to content

Commit

Permalink
feat: Docker image can now be built
Browse files Browse the repository at this point in the history
  • Loading branch information
Yamashi committed Feb 7, 2022
1 parent f70ed8c commit 3ef8308
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 40 deletions.
14 changes: 7 additions & 7 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.git
bin
Build/bin
Build/projects
Libraries/TiltedHooks
Libraries/TiltedReverse
Libraries/TiltedUI
.githooks/*
.github/*
.xmake/*
Services/*
build/*
vsxmake/*
Tools/*
31 changes: 11 additions & 20 deletions Docker.base
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
FROM alpine:latest
FROM ubuntu:latest

ARG make_jobs=8
ARG premake_version=5.0.0-alpha14
ARG protobuf_version=3.9.1
RUN apt update && \
apt-get install software-properties-common unzip -y && \
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
apt update && \
apt install gcc-11 g++-11 curl -y && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11

RUN apk add --no-cache --update autoconf automake build-base libtool openssl-dev linux-headers && \
cd /tmp && \
wget https://github.com/premake/premake-core/releases/download/v${premake_version}/premake-${premake_version}-src.zip && \
unzip -q premake-*.zip && \
cd premake-*/build/gmake.unix/ && \
make config=release -j $make_jobs && \
mv ../../bin/release/premake5 /usr/local/bin && \
cd /tmp && \
wget https://github.com/protocolbuffers/protobuf/releases/download/v${protobuf_version}/protobuf-cpp-${protobuf_version}.zip && \
unzip protobuf-cpp-*.zip && \
cd protobuf-* && \
./autogen.sh && \
./configure --disable-tests && \
make -j $make_jobs && \
make install && \
rm -rf /tmp/*
RUN curl -fsSL https://xmake.io/shget.text > getxmake.sh && \
chmod +x getxmake.sh && \
bash ./getxmake.sh && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
22 changes: 13 additions & 9 deletions Docker.builder
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ ARG make_jobs=8

WORKDIR /home/server

COPY ./Build ./Build
COPY ./Code ./Code
COPY ./modules ./modules
COPY ./Libraries ./Libraries
COPY xmake.lua xmake.lua
COPY ./.git ./.git
COPY ./Code ./Code

RUN export XMAKE_ROOTDIR="/root/.local/bin" && \
export PATH="$XMAKE_ROOTDIR:$PATH" && \
export XMAKE_ROOT=y && \
xmake config -y

RUN ln -s -f /usr/local/bin/premake5 ./Build/premake5 && \
ln -s -f /usr/local/bin/protoc ./Libraries/TiltedConnect/Build/protoc && \
cd Build && \
./MakeGMakeProjects.sh && \
cd projects && \
make config=skyrim_x64 -j $make_jobs && \
make config=fallout4_x64 -j $make_jobs
RUN export XMAKE_ROOTDIR="/root/.local/bin" && \
export PATH="$XMAKE_ROOTDIR:$PATH" && \
export XMAKE_ROOT=y && \
xmake -y -j8
17 changes: 13 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@ ARG project

FROM server:builder AS builder

FROM scratch AS skyrim
COPY --from=builder /home/server/Build/bin/x64/SkyrimTogetherServer /SkyrimTogetherServer
FROM ubuntu AS template
RUN apt update && \
apt-get install software-properties-common unzip -y && \
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
apt update && \
apt install gcc-11 g++-11 libssl-dev -y && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11


FROM template AS skyrim
COPY --from=builder /home/server/build/linux/x64/release/SkyrimTogetherServer /SkyrimTogetherServer
ENTRYPOINT ["/SkyrimTogetherServer"]

FROM scratch AS fallout4
COPY --from=builder /home/server/Build/bin/x64/FalloutTogetherServer /FalloutTogetherServer
FROM template AS fallout4
COPY --from=builder /home/server/build/linux/x64/release/FalloutTogetherServer /FalloutTogetherServer
ENTRYPOINT ["/FalloutTogetherServer"]

FROM ${project} AS final
Expand Down

0 comments on commit 3ef8308

Please sign in to comment.