mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-19 13:25:31 +08:00
done and dusted
This commit is contained in:
parent
21fde5591d
commit
d36a8edd07
@ -1 +1,3 @@
|
|||||||
Dockerfile
|
.venv/
|
||||||
|
tools/pcommand
|
||||||
|
build/cmake/
|
||||||
@ -58,6 +58,7 @@
|
|||||||
multiple `SockAddr`s; it will attempt to contact the host on all of them and
|
multiple `SockAddr`s; it will attempt to contact the host on all of them and
|
||||||
use whichever responds first. This allows us to pass both ipv4 and ipv6
|
use whichever responds first. This allows us to pass both ipv4 and ipv6
|
||||||
addresses when available and transparently use whichever is more performant.
|
addresses when available and transparently use whichever is more performant.
|
||||||
|
- Added `docker-build` and `docker-run` targets to Makefile
|
||||||
|
|
||||||
|
|
||||||
### 1.7.34 (build 21823, api 8, 2024-04-26)
|
### 1.7.34 (build 21823, api 8, 2024-04-26)
|
||||||
|
|||||||
@ -63,4 +63,5 @@
|
|||||||
- Added support for joining using ipv6 address
|
- Added support for joining using ipv6 address
|
||||||
|
|
||||||
### Loup Garou
|
### Loup Garou
|
||||||
- Added sphinx documentation generation
|
- Added sphinx documentation generation
|
||||||
|
- Added docker build
|
||||||
9
do_stuff
9
do_stuff
@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
pwd
|
|
||||||
echo
|
|
||||||
ls
|
|
||||||
echo
|
|
||||||
rm tools/pcommand
|
|
||||||
rm -rf .venv
|
|
||||||
make env
|
|
||||||
make cmake-server-build
|
|
||||||
@ -1,20 +1,24 @@
|
|||||||
|
# if provided it will make debug build
|
||||||
ARG cmake_build_type=Release
|
ARG cmake_build_type=Release
|
||||||
|
|
||||||
|
# system to start with the build with
|
||||||
|
# currently will break for non ubuntu system
|
||||||
ARG base_image=ubuntu:24.04
|
ARG base_image=ubuntu:24.04
|
||||||
|
|
||||||
|
#-------------------------------BUILDER--------------------------------
|
||||||
# Start with the base image
|
# Start with the base image
|
||||||
FROM ${base_image} AS builder
|
FROM ${base_image} AS builder
|
||||||
|
|
||||||
ENV LANG en_US.utf8
|
|
||||||
ENV LANGUAGE=en_US
|
|
||||||
|
|
||||||
# Renew the arg
|
# Renew the arg
|
||||||
ARG cmake_build_type
|
ARG cmake_build_type
|
||||||
|
|
||||||
|
ENV LANG en_US.utf8
|
||||||
|
ENV LANGUAGE=en_US
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
ENV CMAKE_BUILD_TYPE=${cmake_build_type}
|
ENV CMAKE_BUILD_TYPE=${cmake_build_type}
|
||||||
|
|
||||||
# Install build dependencies
|
# Install build dependencies
|
||||||
RUN DEBIAN_FRONTEND=noninteractive \
|
RUN apt-get update -y && \
|
||||||
apt-get update -y && \
|
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
python3.12-dev \
|
python3.12-dev \
|
||||||
python3.12-venv \
|
python3.12-venv \
|
||||||
@ -36,26 +40,30 @@ COPY ./ /home/ubuntu/ballistica
|
|||||||
WORKDIR /home/ubuntu/ballistica
|
WORKDIR /home/ubuntu/ballistica
|
||||||
|
|
||||||
# Compile the application
|
# Compile the application
|
||||||
RUN rm -rf .venv tools/pcommand
|
|
||||||
RUN make cmake-server-build
|
RUN make cmake-server-build
|
||||||
|
RUN mkdir ./../ballistica_cmake_server
|
||||||
|
RUN mv build/cmake/* ./../ballistica_cmake_server
|
||||||
|
|
||||||
|
#-------------------------------RUNNER--------------------------------
|
||||||
# Create a new stage for the runtime environment
|
# Create a new stage for the runtime environment
|
||||||
FROM ${base_image}
|
FROM ${base_image}
|
||||||
|
|
||||||
# Renew the arg
|
|
||||||
ARG cmake_build_type
|
|
||||||
|
|
||||||
ENV LANG en_US.utf8
|
ENV LANG en_US.utf8
|
||||||
ENV LANGUAGE=en_US
|
ENV LANGUAGE=en_US
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
WORKDIR /home/ubuntu/ballistica
|
# Renew the arg
|
||||||
|
ARG cmake_build_type
|
||||||
|
LABEL BUILD_TYPE=${cmake_build_type}
|
||||||
|
|
||||||
|
ARG bombsquad_build=N/A
|
||||||
|
LABEL BOMBSQUAD_BUILD=${bombsquad_build}
|
||||||
|
|
||||||
ARG bombsquad_version=N/A
|
ARG bombsquad_version=N/A
|
||||||
LABEL BOMBSQUAD_VERSION=${bombsquad_version}
|
LABEL BOMBSQUAD_VERSION=${bombsquad_version}
|
||||||
|
|
||||||
# Install runtime dependencies
|
# Install runtime dependencies
|
||||||
RUN DEBIAN_FRONTEND=noninteractive \
|
RUN apt-get update -y && \
|
||||||
apt-get update -y && \
|
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
python3.12-venv \
|
python3.12-venv \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
@ -63,11 +71,17 @@ RUN DEBIAN_FRONTEND=noninteractive \
|
|||||||
libvorbisfile3 \
|
libvorbisfile3 \
|
||||||
freeglut3-dev \
|
freeglut3-dev \
|
||||||
libopenal1 \
|
libopenal1 \
|
||||||
curl
|
curl \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Copy the compiled application from the builder stage
|
# Copy the compiled application from the builder stage
|
||||||
COPY --from=builder /home/ubuntu/ballistica/build/cmake/server-debug/staged/ /home/ubuntu/ballistica
|
COPY --from=builder /home/ubuntu/ballistica_cmake_server/*/staged \
|
||||||
COPY --from=builder /home/ubuntu/ballistica/build/cmake/server-debug/ballisticakit_headless /home/ubuntu/ballistica/dist
|
/home/ubuntu/ballistica
|
||||||
|
# ballisticakit_headless in staged is a symlink
|
||||||
|
COPY --from=builder /home/ubuntu/ballistica_cmake_server/*/ballisticakit_headless \
|
||||||
|
/home/ubuntu/ballistica/dist
|
||||||
|
|
||||||
|
WORKDIR /home/ubuntu/ballistica
|
||||||
|
|
||||||
# Expose the necessary port
|
# Expose the necessary port
|
||||||
EXPOSE 43210/udp
|
EXPOSE 43210/udp
|
||||||
@ -645,27 +645,33 @@ def cmake_prep_dir(dirname: str, verbose: bool = False) -> None:
|
|||||||
if verbose:
|
if verbose:
|
||||||
print(f'{Clr.BLD}{title}:{Clr.RST} Keeping existing build dir.')
|
print(f'{Clr.BLD}{title}:{Clr.RST} Keeping existing build dir.')
|
||||||
|
|
||||||
def _docker_build(image_name,
|
def _docker_build(image_name : str,
|
||||||
dockerfile_dir,
|
dockerfile_dir : str,
|
||||||
bombsquad_version = None,
|
bombsquad_version : str|None = None,
|
||||||
project_root = None) -> None:
|
bombsquad_build : str|int|None = None,
|
||||||
|
cmake_build_type : str|None = None) -> None:
|
||||||
|
|
||||||
build_cmd = ['docker','image','build',
|
build_cmd = ['docker','image','build',
|
||||||
'-t',image_name,
|
'-t',image_name,
|
||||||
dockerfile_dir,
|
dockerfile_dir,
|
||||||
]
|
]
|
||||||
if bombsquad_version is not None:
|
if bombsquad_version is not None:
|
||||||
build_cmd = build_cmd+['--build-arg', f'BOMBSQUAD_VERSION={bombsquad_version}']
|
build_cmd = build_cmd+['--build-arg', f'bombsquad_version={bombsquad_version}']
|
||||||
# if project_root is not None:
|
if bombsquad_build is not None:
|
||||||
# print(project_root)
|
build_cmd = build_cmd+['--build-arg', f'bombsquad_build={str(bombsquad_build)}']
|
||||||
# build_cmd = build_cmd+['--build-arg', f'PROJ_ROOT={project_root}']
|
if cmake_build_type is not None:
|
||||||
|
build_cmd = build_cmd+['--build-arg', f'cmake_build_type={cmake_build_type}']
|
||||||
subprocess.run(build_cmd,check=True)
|
subprocess.run(build_cmd,check=True)
|
||||||
|
|
||||||
# add option to toggle between prefab and cmake
|
# todo: add option to toggle between prefab and cmake
|
||||||
def docker_build() -> None:
|
def docker_build() -> None:
|
||||||
|
import shutil
|
||||||
|
shutil.copy("src/assets/docker/Dockerfile",".")
|
||||||
|
from batools import version
|
||||||
|
version_num,build_num =version.get_current_version()
|
||||||
_docker_build('bsquad',
|
_docker_build('bsquad',
|
||||||
'.',
|
'.',
|
||||||
'1.7.69',
|
version_num,
|
||||||
os.getcwd(),
|
build_num,
|
||||||
)
|
)
|
||||||
|
os.remove("Dockerfile")
|
||||||
@ -667,8 +667,6 @@ def prefab_binary_path() -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def build_docker() -> None:
|
def build_docker() -> None:
|
||||||
pass
|
|
||||||
import subprocess
|
|
||||||
import batools.build
|
import batools.build
|
||||||
batools.build.docker_build()
|
batools.build.docker_build()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user