Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6e812cb
Add Docker support and CI workflow
enzofrnt Jan 11, 2026
1e0fd1d
Add docker-support branch to workflow triggers
enzofrnt Jan 11, 2026
e42b41c
Refactor Docker build and update CI caching
enzofrnt Jan 11, 2026
ea917f2
Set IMAGE_NAME dynamically in Docker workflow
enzofrnt Jan 11, 2026
11971a5
Update Docker workflow to set IMAGE_NAME in env
enzofrnt Jan 11, 2026
129751d
Update BeamMP-Server copy path in Dockerfile
enzofrnt Jan 11, 2026
1647e6b
Split Docker build workflow by architecture
enzofrnt Jan 11, 2026
f06543d
Refactor Docker workflow to use matrix build
enzofrnt Jan 11, 2026
fccea15
Update docker/build-push-action to v6 in workflow
enzofrnt Jan 11, 2026
6fa4a5e
Add Docker build cache configuration to workflow
enzofrnt Jan 11, 2026
d182a9b
Disable provenance and SBOM in Docker build
enzofrnt Jan 11, 2026
a566097
Clean up Dockerfile comments and update copy note
enzofrnt Jan 11, 2026
44431bc
Update BeamMP server image in compose.yaml
enzofrnt Jan 11, 2026
dc4670b
Remove commented configuration from compose.yaml
enzofrnt Jan 11, 2026
c9aaee5
Remove 'docker-support' branch from workflow triggers
enzofrnt Jan 11, 2026
554ee51
Fix image name casing in Docker Compose file
enzofrnt Jan 11, 2026
593d05a
Update Docker CMD and resource volume paths
enzofrnt Jan 11, 2026
9c5fbd1
Add .env example and update Docker config
enzofrnt Jan 11, 2026
eb87c3d
Improve docker workflow (#1)
enzofrnt Jan 11, 2026
c957523
docker: add Lua + LuaRocks support (#2)
enzofrnt Jan 12, 2026
3572255
Remove obsolete branch from Docker workflow
enzofrnt Jan 12, 2026
4edcbc0
Update .env.example with default BeamMP values
enzofrnt Jan 12, 2026
e7ab580
Use BEAMMP_PORT env variable for port mapping
enzofrnt Jan 12, 2026
719cfaf
Tidy Docker files, workflow comments, and ignores
enzofrnt Mar 8, 2026
e9a549d
Add provider disable flag and remove config mount
enzofrnt Mar 9, 2026
9066648
Remove Resources volume mount from compose.yaml
enzofrnt Mar 18, 2026
c117b1b
Document BeamMP Server env link in .env.example
enzofrnt Mar 18, 2026
fe93f07
Set BEAMMP_PROVIDER_DISABLE_CONFIG in compose
enzofrnt Mar 18, 2026
8fafe13
Remove default CMD from Dockerfile
enzofrnt Mar 18, 2026
27cf7bf
Revert "Remove Resources volume mount from compose.yaml"
enzofrnt Mar 18, 2026
dca9fbd
Remove volume comment in compose.yaml
enzofrnt Mar 18, 2026
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
26 changes: 26 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.git/
build/
cmake-build-*/
bin/
out/
.cache/
**/.DS_Store

# IDE
.idea/
.vs/
*.user
*.suo

# CI
.github/

# Scripts (pas nécessaires au build Docker ici)
scripts/

# Docs (garde README si tu veux)
*.md
!README.md

# Docker files (garde ce dont tu as besoin)
docker-compose*.yml
65 changes: 65 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Docker Build

on:
push:
branches:
- 'develop'
- 'minor'
tags:
- 'v*'
pull_request:

env:
REGISTRY: ghcr.io

jobs:
build:
strategy:
matrix:
include:
- arch: amd64
platform: linux/amd64
runner: ubuntu-latest
- arch: arm64
platform: linux/arm64
runner: ubuntu-24.04-arm

runs-on: ${{ matrix.runner }}

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Set image name
run: echo "IMAGE_NAME=${GITHUB_REPOSITORY@L}" >> $GITHUB_ENV

- uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ env.IMAGE_NAME }}

- uses: docker/build-push-action@v6
with:
context: .
platforms: ${{ matrix.platform }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/${{ env.IMAGE_NAME }}:buildcache-${{ matrix.arch }}
cache-to: type=registry,ref=ghcr.io/${{ env.IMAGE_NAME }}:buildcache-${{ matrix.arch }},mode=max
provenance: false
sbom: false
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -478,3 +478,6 @@ callgrind.*
notes/*
compile_commands.json
nohup.out


build/
92 changes: 92 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
FROM debian:12-slim AS builder

ARG VCPKG_COMMIT=5bf0c55239da398b8c6f450818c9e28d36bf9966
ARG BUILD_PARALLEL=2
ARG ENABLE_LTO=ON

ENV DEBIAN_FRONTEND=noninteractive \
CMAKE_BUILD_TYPE=Release \
VCPKG_FORCE_SYSTEM_BINARIES=1 \
VCPKG_FEATURE_FLAGS=manifests

WORKDIR /work

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
zip unzip tar \
git \
cmake \
ninja-build \
build-essential \
pkg-config \
liblua5.3-0 liblua5.3-dev \
binutils \
&& rm -rf /var/lib/apt/lists/*

RUN git clone https://github.com/microsoft/vcpkg /work/vcpkg && \
cd /work/vcpkg && \
git checkout ${VCPKG_COMMIT} && \
./bootstrap-vcpkg.sh -disableMetrics

ENV VCPKG_ROOT=/work/vcpkg

COPY vcpkg.json ./
COPY deps/ ./deps/
COPY cmake/ ./cmake/
COPY CMakeLists.txt ./
COPY include/ ./include/
COPY src/ ./src/
COPY test/ ./test/

RUN --mount=type=cache,target=/root/.cache/vcpkg,sharing=locked \
--mount=type=cache,target=/work/vcpkg/downloads,sharing=locked \
--mount=type=cache,target=/work/vcpkg/buildtrees,sharing=locked \
--mount=type=cache,target=/work/vcpkg/packages,sharing=locked \
--mount=type=cache,target=/work/build-server,sharing=locked \
mkdir -p /work/out && \
cmake -S /work -B /work/build-server -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=/work/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="-O3 -g -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,-z,noseparate-code -ffunction-sections -fdata-sections -Wl,--gc-sections" \
-DBeamMP-Server_ENABLE_LTO=${ENABLE_LTO} \
&& cmake --build /work/build-server --parallel ${BUILD_PARALLEL} -t BeamMP-Server \
&& objcopy --only-keep-debug /work/build-server/BeamMP-Server /work/build-server/BeamMP-Server.debug \
&& strip --strip-unneeded /work/build-server/BeamMP-Server \
&& objcopy --add-gnu-debuglink=/work/build-server/BeamMP-Server.debug /work/build-server/BeamMP-Server \
&& install -m 0755 /work/build-server/BeamMP-Server /work/out/BeamMP-Server

RUN --mount=type=cache,target=/root/.cache/vcpkg,sharing=locked \
--mount=type=cache,target=/work/vcpkg/downloads,sharing=locked \
--mount=type=cache,target=/work/vcpkg/buildtrees,sharing=locked \
--mount=type=cache,target=/work/vcpkg/packages,sharing=locked \
--mount=type=cache,target=/work/build-tests,sharing=locked \
cmake -S /work -B /work/build-tests -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=/work/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBeamMP-Server_ENABLE_LTO=OFF \
&& cmake --build /work/build-tests --parallel 1 -t BeamMP-Server-tests

FROM debian:12-slim AS runtime

RUN apt-get update && apt-get install -y --no-install-recommends \
liblua5.3-0 \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

RUN useradd -m -u 1000 beammp && \
mkdir -p /app /app/data /config /resources && \
chown -R beammp:beammp /app /config /resources

# /work/build-server is a BuildKit cache mount (not persisted in layers), so copy from /work/out.
COPY --from=builder /work/out/BeamMP-Server /app/BeamMP-Server

WORKDIR /app
USER beammp

EXPOSE 30814
ENTRYPOINT ["/app/BeamMP-Server"]
CMD ["--config=/config/ServerConfig.toml", "--working-directory=/app"]
41 changes: 29 additions & 12 deletions cmake/Git.cmake
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
find_package(Git)
find_package(Git QUIET)

# Only try to update submodules if:
# - the option is enabled
# - git is available
# - we are in a real git checkout (".git" exists)
if(${PROJECT_NAME}_CHECKOUT_GIT_SUBMODULES)
if(Git_FOUND)
message(STATUS "Git found, submodule update and init")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(SEND_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules. This may result in missing dependencies.")
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
message(STATUS "Git found, submodule update and init")
execute_process(
COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE GIT_SUBMOD_RESULT
)
if(NOT GIT_SUBMOD_RESULT EQUAL 0)
message(SEND_ERROR
"git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules. "
"This may result in missing dependencies."
)
endif()
else()
message(STATUS "No .git directory found - skipping submodule update (assume submodules are already present).")
endif()
else()
message(SEND_ERROR "git required for checking out submodules, but not found. Submodules will not be checked out - this may result in missing dependencies.")
message(SEND_ERROR
"git required for checking out submodules, but not found. Submodules will not be checked out - "
"this may result in missing dependencies."
)
endif()
endif()

if(Git_FOUND)

if(Git_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
# If you compute PRJ_GIT_HASH somewhere else, keep that logic there.
else()
message(STATUS "Git not found - the version will not include a git hash.")
message(STATUS "Git not found (or not a git checkout) - the version will not include a git hash.")
set(PRJ_GIT_HASH "unknown")
endif()
endif()
21 changes: 21 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
services:
beammp-server:
build:
context: .
dockerfile: Dockerfile
image: ghcr.io/BeamMP/beammp-server
container_name: beammp-server
restart: unless-stopped
ports:
- "30814:30814/tcp"
- "30814:30814/udp"
volumes:
# Mount configuration directory
- ./config:/config
# Mount resources directory (mods, plugins, etc.)
- ./resources:/resources:ro
# Mount working directory for logs and data
- ./data:/app/data
environment:
- TZ=UTC