Skip to content

Commit

Permalink
Fix Docker Build (#205)
Browse files Browse the repository at this point in the history
* Fix docker build

Fix build after recent Eluna changes
Changed base image to Ubuntu 22:04
Switched compiler to clang

* Add docker workflow

---------

Co-authored-by: PargeLenis <dead.man.walkin@hotmail.de>
  • Loading branch information
2 people authored and billy1arm committed Mar 2, 2025
1 parent 08f4df5 commit 1286e47
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 25 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Docker Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout Submodules
shell: bash
run: |
git submodule init && git submodule update
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build Mangosd Docker image
run: |
docker build -t mangosd:latest -f dockercontainer/DockerFile-mangosd .
- name: Build Realmd Docker image
run: |
docker build -t realmd:latest -f dockercontainer/DockerFile-realmd .
29 changes: 16 additions & 13 deletions dockercontainer/DockerFile-mangosd
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
#Build image
FROM ubuntu:18.04 as build-step
FROM ubuntu:22.04 AS build-step

RUN apt-get -y update
RUN apt-get -y install curl autoconf automake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool build-essential gpg wget lsb-release software-properties-common
ENV TZ=US DEBIAN_FRONTEND=noninteractive

RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null && \
apt-get update
RUN apt-get -y install cmake
RUN apt-get -y update
RUN apt-get -y install curl autoconf automake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool \
build-essential lsb-release software-properties-common cmake libreadline-dev clang

COPY . /mangoserver
RUN mkdir /mangoserver/build
RUN mkdir /mangoserver/build && cd /mangoserver/build
WORKDIR /mangoserver/build

#Install mangos
RUN cmake .. -DCMAKE_INSTALL_PREFIX=/mangos -DBUILD_MANGOSD=1 -DBUILD_REALMD=0 -DBUILD_TOOLS=0
RUN cmake .. -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/mangos -DBUILD_MANGOSD=1 -DBUILD_REALMD=0 -DBUILD_TOOLS=0
RUN make -j4
RUN make install

#Runtime image
FROM ubuntu:18.04 as runtime
FROM ubuntu:22.04 AS runtime

ENV TZ=US DEBIAN_FRONTEND=noninteractive

RUN apt-get -y update && apt-get -y upgrade
RUN apt-get -y install libmysqlclient20 openssl
RUN apt-get -y install libmysqlclient-dev openssl lua-readline

COPY --from=build-step /mangos /mangos
COPY --from=build-step /etc/mangosd.conf.dist ../etc/mangosd.conf.dist
COPY --from=build-step /etc/mangosd.conf.dist /mangos/etc/mangosd.conf.dist

RUN echo "/mangos/lib" >> /etc/ld.so.conf && ldconfig

WORKDIR /mangos/bin
RUN chmod +x mangosd

EXPOSE 8085
ENTRYPOINT [ "./mangosd" ]
ENTRYPOINT [ "./mangosd","-c","/mangos/etc/mangosd.conf" ]
22 changes: 10 additions & 12 deletions dockercontainer/DockerFile-realmd
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
#Build image
FROM ubuntu:18.04 as build-step
FROM ubuntu:22.04 AS build-step

ENV TZ=US DEBIAN_FRONTEND=noninteractive

RUN apt-get -y update
RUN apt-get -y install curl autoconf automake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool build-essential gpg wget
RUN apt-get -y install curl autoconf automake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool \
build-essential lsb-release software-properties-common cmake libreadline-dev clang

RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null && \
apt-get update
RUN apt-get -y install cmake

COPY . /mangoserver
RUN mkdir /mangoserver/build
WORKDIR /mangoserver/build

#Install mangos
RUN cmake .. -DCMAKE_INSTALL_PREFIX=/mangos -DBUILD_MANGOSD=0 -DBUILD_REALMD=1 -DBUILD_TOOLS=0
RUN cmake .. -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/mangos -DBUILD_MANGOSD=0 -DBUILD_REALMD=1 -DBUILD_TOOLS=0
RUN make -j4
RUN make install

#Runtime image
FROM ubuntu:18.04 as runtime
FROM ubuntu:22.04 AS runtime

RUN apt-get -y update && apt-get -y upgrade
RUN apt-get -y install libmysqlclient20 openssl
RUN apt-get -y install libmysqlclient-dev openssl

COPY --from=build-step /mangos /mangos
COPY --from=build-step /etc/realmd.conf.dist ../etc/realmd.conf.dist
COPY --from=build-step /etc/realmd.conf.dist /mangos/etc/realmd.conf.dist
WORKDIR /mangos/bin
RUN chmod +x realmd

EXPOSE 3724
ENTRYPOINT [ "./realmd" ]
ENTRYPOINT [ "./realmd","-c","/mangos/etc/realmd.conf" ]

0 comments on commit 1286e47

Please sign in to comment.