diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..4af303277 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +Dockerfile* +.git +.github +vs2022 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..5a0a88b09 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM quay.io/centos/centos:stream AS buildbase +RUN yum -y install tar unzip glibc.i686 gcc dos2unix cmake gcc-c++ && yum clean all && rm -rf /var/cache/yum +RUN mkdir -p ~/uox3 + +FROM buildbase AS buildapp +WORKDIR /root/uox3 +COPY . . +RUN find /root/uox3 -name \* -type f -exec dos2unix {} \; +RUN cd /root/uox3 && ./automake.sh +CMD ["/bin/bash"] + +FROM quay.io/centos/centos:stream +RUN yum -y install glibc.i686 dos2unix && yum clean all && rm -rf /var/cache/yum +RUN adduser --system --create-home uox3 +USER uox3 +RUN mkdir -p ~/app +WORKDIR /home/uox3/app +COPY --from=buildapp --chown=uox3 /root/uox3/uox3 . +COPY --chown=uox3 data data/ +COPY --chown=uox3 docs docs/ +COPY --chown=uox3 docker/run.sh . +RUN chmod 777 /home/uox3/app/run.sh && dos2unix /home/uox3/app/run.sh +CMD ["/home/uox3/app/run.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 740fc525c..f362fb83f 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Join the [UOX3 Discord](https://discord.gg/uBAXxhF) for support and/or a quick c > * **Linux (Debian-based)** - Run `sudo apt install build-essential cmake` in a Terminal: (or use your Linux distro's package manager) > * **FreeBSD** - Run `pkg install cmake` in a Terminal. Alternatively, build `cmake` via ports if desired. > * **macOS** - Download [Xcode](https://apps.apple.com/us/app/xcode/id497799835?mt=12) (for building with an IDE) via the App Store, and/or [CMake](https://cmake.org/download/) (for command-line builds) + > * **Docker/Podman** - Ensure that it is downloaded and installed (Windows) or installed from your package manager
@@ -157,6 +158,11 @@ Join the [UOX3 Discord](https://discord.gg/uBAXxhF) for support and/or a quick c
+
+ Docker/Podman + + Build and tag the image from the root of the repository like: `docker buildx build --progress=plain -t uox3 .` or `podman build -t uox3 .` +
--- ## UOX3 Compiled! Now what? diff --git a/automake.sh b/automake.sh index 9488d6733..b187c0974 100755 --- a/automake.sh +++ b/automake.sh @@ -63,4 +63,4 @@ else echo "uox3 program not found! Please review the build status." cd ../../.. fi -fi \ No newline at end of file +fi diff --git a/docker/.gitattributes b/docker/.gitattributes new file mode 100644 index 000000000..526c8a38d --- /dev/null +++ b/docker/.gitattributes @@ -0,0 +1 @@ +*.sh text eol=lf \ No newline at end of file diff --git a/docker/run.sh b/docker/run.sh new file mode 100644 index 000000000..a65456daf --- /dev/null +++ b/docker/run.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +cd ~/app +./uox3 data/uox.ini diff --git a/make/cmake/CMakeLists.txt b/make/cmake/CMakeLists.txt index 0ca04a77c..4b17865e9 100644 --- a/make/cmake/CMakeLists.txt +++ b/make/cmake/CMakeLists.txt @@ -236,6 +236,7 @@ target_link_libraries(uox3 PRIVATE $<$:Kernel32> $<$:pthread> $<$:pthread> + $<$,$,9.0>>:stdc++fs> ) # ************************************************************************* diff --git a/source/Makefile b/source/Makefile index cd36e0f5e..983c5d093 100644 --- a/source/Makefile +++ b/source/Makefile @@ -7,6 +7,7 @@ ifeq ($(PLATFORM),FreeBSD) CXX := clang++ else CXX := g++ +GCCVER8 := $(shell expr `gcc -dumpversion | cut -f1 -d.` \<= 8) endif CXXFLAGS := -std=c++17 -O2 -pthread -Wno-shift-negative-value -Wall -Wextra -Wno-attributes @@ -22,6 +23,10 @@ BUILD := ./build SRC := $(wildcard *.cpp) OBJECTS := $(SRC:%.cpp=$(BUILD)/%.o) +ifeq "$(GCCVER8)" "1" + LDFLAGS += -lstdc++fs +endif + #COMPILE := $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(INCLUDE) -c all: build $(TARGET)