mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-04 22:43:17 +08:00
commit
86ec29c90a
@ -8,7 +8,7 @@ ARG base_image=ubuntu:latest
|
|||||||
|
|
||||||
#-------------------------------BUILDER--------------------------------
|
#-------------------------------BUILDER--------------------------------
|
||||||
# Start with the base image
|
# Start with the base image
|
||||||
FROM ${base_image} AS builder
|
FROM --platform=$TARGETPLATFORM ${base_image} AS builder
|
||||||
|
|
||||||
# Renew the args
|
# Renew the args
|
||||||
ARG headless_build
|
ARG headless_build
|
||||||
@ -23,20 +23,22 @@ ENV CMAKE_BUILD_TYPE=${cmake_build_type}
|
|||||||
ENV HEADLESS_BUILD=${headless_build}
|
ENV HEADLESS_BUILD=${headless_build}
|
||||||
|
|
||||||
# Install build dependencies
|
# Install build dependencies
|
||||||
RUN apt-get update -y && \
|
RUN apt-get update && \
|
||||||
apt-get install -y \
|
apt-get install -y --no-install-recommends \
|
||||||
python3.12-dev \
|
build-essential \
|
||||||
python3.12-venv \
|
clang \
|
||||||
python3-pip \
|
clang-format \
|
||||||
libsdl2-dev \
|
cmake \
|
||||||
|
curl \
|
||||||
libglut-dev \
|
libglut-dev \
|
||||||
libopenal-dev \
|
libopenal-dev \
|
||||||
|
libsdl2-dev \
|
||||||
libvorbis-dev \
|
libvorbis-dev \
|
||||||
make \
|
make \
|
||||||
curl \
|
python3-pip \
|
||||||
rsync \
|
python3.12-dev \
|
||||||
clang-format \
|
python3.12-venv \
|
||||||
cmake
|
rsync
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code
|
||||||
COPY ./ /ballistica
|
COPY ./ /ballistica
|
||||||
@ -55,13 +57,12 @@ RUN mkdir /ballistica_cmake && \
|
|||||||
fi && \
|
fi && \
|
||||||
mv build/cmake/*/staged/* /ballistica_cmake
|
mv build/cmake/*/staged/* /ballistica_cmake
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------RUNNER--------------------------------
|
#-------------------------------RUNNER--------------------------------
|
||||||
# Create a new stage for the runtime environment
|
# Create a new stage for the runtime environment
|
||||||
FROM ${base_image}
|
FROM --platform=$TARGETPLATFORM ${base_image} as runner
|
||||||
|
|
||||||
# Environment settings
|
# Environment settings
|
||||||
ENV LANG en_US.utf8
|
ENV LANG=en_US.utf8
|
||||||
ENV LANGUAGE=en_US
|
ENV LANGUAGE=en_US
|
||||||
ENV LC_ALL=en_US.utf8
|
ENV LC_ALL=en_US.utf8
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
@ -70,11 +71,10 @@ ENV DEBIAN_FRONTEND=noninteractive
|
|||||||
ARG headless_build
|
ARG headless_build
|
||||||
ENV HEADLESS_BUILD=${headless_build}
|
ENV HEADLESS_BUILD=${headless_build}
|
||||||
ARG cmake_build_type
|
ARG cmake_build_type
|
||||||
|
|
||||||
LABEL BOMBSQUAD_BUILD_TYPE=${cmake_build_type}
|
LABEL BOMBSQUAD_BUILD_TYPE=${cmake_build_type}
|
||||||
|
|
||||||
# Install runtime dependencies
|
# Install runtime dependencies
|
||||||
RUN apt-get update -y && \
|
RUN apt-get update && \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
python3.12-dev && \
|
python3.12-dev && \
|
||||||
if [ "$HEADLESS_BUILD" = "0" ]; then \
|
if [ "$HEADLESS_BUILD" = "0" ]; then \
|
||||||
|
|||||||
@ -1,103 +0,0 @@
|
|||||||
# if provided it will make debug build
|
|
||||||
ARG cmake_build_type=Release
|
|
||||||
# whether to make GUI or headless build (defaults to headless)
|
|
||||||
ARG headless_build=1
|
|
||||||
# system to start with the build with
|
|
||||||
# currently will break for other images
|
|
||||||
ARG base_image=ubuntu:latest
|
|
||||||
|
|
||||||
#-------------------------------BUILDER--------------------------------
|
|
||||||
# Start with the base image
|
|
||||||
FROM --platform=linux/arm64 ${base_image} AS builder
|
|
||||||
|
|
||||||
# Renew the args
|
|
||||||
ARG headless_build
|
|
||||||
ARG cmake_build_type
|
|
||||||
|
|
||||||
# Environment settings
|
|
||||||
ENV LANG=en_US.utf8
|
|
||||||
ENV LANGUAGE=en_US
|
|
||||||
ENV LC_ALL=en_US.utf8
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
|
||||||
ENV CMAKE_BUILD_TYPE=${cmake_build_type}
|
|
||||||
ENV HEADLESS_BUILD=${headless_build}
|
|
||||||
|
|
||||||
# Install build dependencies
|
|
||||||
RUN apt-get install -y --no-install-recommends \
|
|
||||||
python3.12-dev \
|
|
||||||
python3.12-venv \
|
|
||||||
python3-pip \
|
|
||||||
libsdl2-dev \
|
|
||||||
libglut-dev \
|
|
||||||
libopenal-dev \
|
|
||||||
make \
|
|
||||||
curl \
|
|
||||||
rsync \
|
|
||||||
clang-format \
|
|
||||||
clang \
|
|
||||||
cmake \
|
|
||||||
libvorbis-dev \
|
|
||||||
build-essential
|
|
||||||
|
|
||||||
# Copy source code
|
|
||||||
COPY ./ /ballistica
|
|
||||||
|
|
||||||
# Set the working directory
|
|
||||||
WORKDIR /ballistica
|
|
||||||
|
|
||||||
# Compile the application
|
|
||||||
RUN mkdir /ballistica_cmake && \
|
|
||||||
if [ "$HEADLESS_BUILD" != "0" ]; then \
|
|
||||||
make cmake-server-build && \
|
|
||||||
mv build/cmake/*/ballisticakit_headless build/cmake/*/staged/dist; \
|
|
||||||
else \
|
|
||||||
make cmake-build && \
|
|
||||||
mv build/cmake/*/ballisticakit build/cmake/*/staged/; \
|
|
||||||
fi && \
|
|
||||||
mv build/cmake/*/staged/* /ballistica_cmake
|
|
||||||
|
|
||||||
#-------------------------------RUNNER--------------------------------
|
|
||||||
# Create a new stage for the runtime environment using ARM64 base image
|
|
||||||
FROM --platform=linux/arm64 ${base_image}
|
|
||||||
|
|
||||||
# Environment settings
|
|
||||||
ENV LANG en_US.utf8
|
|
||||||
ENV LANGUAGE=en_US
|
|
||||||
ENV LC_ALL=en_US.utf8
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
# Renew the args
|
|
||||||
ARG headless_build
|
|
||||||
ENV HEADLESS_BUILD=${headless_build}
|
|
||||||
ARG cmake_build_type
|
|
||||||
LABEL BOMBSQUAD_BUILD_TYPE=${cmake_build_type}
|
|
||||||
|
|
||||||
# Install runtime dependencies
|
|
||||||
RUN apt-get update -y && \
|
|
||||||
apt-get install -y \
|
|
||||||
python3.12-dev && \
|
|
||||||
if [ "$HEADLESS_BUILD" = "0" ]; then \
|
|
||||||
apt-get install -y \
|
|
||||||
libsdl2-dev \
|
|
||||||
libvorbis-dev \
|
|
||||||
libglut-dev \
|
|
||||||
pulseaudio-utils \
|
|
||||||
libopenal-dev; \
|
|
||||||
fi && \
|
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
|
||||||
python3.12 -c "import uuid; print(uuid.uuid4())" > /etc/machine-id
|
|
||||||
|
|
||||||
# Copy the compiled application from the builder stage
|
|
||||||
COPY --from=builder /ballistica_cmake \
|
|
||||||
/home/ubuntu/ballistica
|
|
||||||
|
|
||||||
# Set the working directory
|
|
||||||
WORKDIR /home/ubuntu/ballistica
|
|
||||||
|
|
||||||
RUN ln -s ballisticakit* run
|
|
||||||
|
|
||||||
# Expose the necessary port
|
|
||||||
EXPOSE 43210/udp
|
|
||||||
|
|
||||||
# Set the default command to run the application
|
|
||||||
CMD [ "./run" ]
|
|
||||||
@ -72,10 +72,7 @@ def docker_build(
|
|||||||
headless_build=headless_build, build_type=build_type
|
headless_build=headless_build, build_type=build_type
|
||||||
)
|
)
|
||||||
|
|
||||||
if platform is not None and 'arm64' in platform:
|
config_file = 'config/docker/Dockerfile'
|
||||||
config_file = 'config/docker/Dockerfile_arm64'
|
|
||||||
else:
|
|
||||||
config_file = 'config/docker/Dockerfile'
|
|
||||||
|
|
||||||
print(
|
print(
|
||||||
f'Building docker image {image_name} '
|
f'Building docker image {image_name} '
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user