From 2096c3c3cc2466f74e78f0e023a298c563311943 Mon Sep 17 00:00:00 2001 From: Juansecu Date: Sat, 8 Jun 2024 21:55:03 -0500 Subject: [PATCH 1/2] BUILD - Optimize Dockerfile by using alpine as base image --- Dockerfile | 19 ++++++++++++------- src/settings.hpp | 3 ++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9e5eb52..1ced935 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,33 @@ # build -FROM debian:stable-slim as build +FROM alpine:3 as build WORKDIR /usr/src/app -RUN apt-get -y update && apt-get install -y \ +RUN apk update && apk upgrade && apk add \ +linux-headers \ git \ -clang \ +clang18 \ make \ -libsqlite3-dev +sqlite-dev COPY src ./src COPY vendor ./vendor COPY .git ./.git COPY Makefile CMakeLists.txt version.h.in ./ +RUN sed -i 's/^CC=clang$/&-18/' Makefile +RUN sed -i 's/^CXX=clang++$/&-18/' Makefile + RUN make -j8 # prod -FROM debian:stable-slim +FROM alpine:3 WORKDIR /usr/src/app -RUN apt-get -y update && apt-get install -y \ -libsqlite3-dev +RUN apk update && apk upgrade && apk add \ +libstdc++ \ +sqlite-dev COPY --from=build /usr/src/app/bin/fusion /bin/fusion COPY sql ./sql diff --git a/src/settings.hpp b/src/settings.hpp index 85fad68..71eb1a4 100644 --- a/src/settings.hpp +++ b/src/settings.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include namespace settings { @@ -13,7 +14,7 @@ namespace settings { extern std::string SHARDSERVERIP; extern bool LOCALHOSTWORKAROUND; extern bool ANTICHEAT; - extern time_t TIMEOUT; + extern int64_t TIMEOUT; extern int VIEWDISTANCE; extern bool SIMULATEMOBS; extern int SPAWN_X; From 352fa8a133b7222c215d73d10ea3f9800769286c Mon Sep 17 00:00:00 2001 From: Juansecu <43616657+Juansecu@users.noreply.github.com> Date: Wed, 9 Oct 2024 19:13:54 -0500 Subject: [PATCH 2/2] BUILD - Expose ports used by the application server in Dockerfile --- Dockerfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Dockerfile b/Dockerfile index 1ced935..b93e54d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,10 @@ RUN make -j8 # prod FROM alpine:3 +ENV AUTHENTICATION_PORT 23000 +ENV MONITORING_PORT 8003 +ENV SHARDING_PORT 23001 + WORKDIR /usr/src/app RUN apk update && apk upgrade && apk add \ @@ -32,6 +36,10 @@ sqlite-dev COPY --from=build /usr/src/app/bin/fusion /bin/fusion COPY sql ./sql +EXPOSE $AUTHENTICATION_PORT +EXPOSE $MONITORING_PORT +EXPOSE $SHARDING_PORT + CMD ["/bin/fusion"] LABEL Name=openfusion Version=0.0.2