Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUILD - Optimize Dockerfile by using alpine as base image #277

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,45 @@
# 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

ENV AUTHENTICATION_PORT 23000
ENV MONITORING_PORT 8003
ENV SHARDING_PORT 23001

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

EXPOSE $AUTHENTICATION_PORT
EXPOSE $MONITORING_PORT
EXPOSE $SHARDING_PORT

CMD ["/bin/fusion"]

LABEL Name=openfusion Version=0.0.2
3 changes: 2 additions & 1 deletion src/settings.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <stdint.h>
#include <string>

namespace settings {
Expand All @@ -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;
Expand Down
Loading