From 99491da72628e895667a21617c4ee029dc3b3f65 Mon Sep 17 00:00:00 2001 From: choelzl Date: Sat, 12 Nov 2022 14:56:07 +0100 Subject: [PATCH] first commit --- .drone.yml | 17 +++++++++++ Dockerfile | 74 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 14 +++++++++ 3 files changed, 105 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..f1881d7 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,17 @@ +pipeline: + deploy-production: + image: docker/compose + volumes: + - /var/run/docker.sock:/var/run/docker.sock + commands: + - docker-compose -p ottd up -d --force-recreate --build + when: + event: push + branch: [master] + + test-pr: + image: docker/compose + commands: + - echo "1" + when: + event: push diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fd8902e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,74 @@ +FROM debian:stable as builder +WORKDIR /tmp + +ENV jgrpp_version=0.49.0 +ENV opengfx_version=7.1 + + +RUN apt-get update +RUN apt-get upgrade -y +RUN apt-get install -y \ + cmake \ + curl \ + unzip \ + xz-utils \ + build-essential \ + ninja-build \ + pkg-config \ + zlib1g \ + zlib1g-dev \ + liblzma5 \ + liblzma-dev \ + liblzo2-2 \ + liblzo2-dev \ + libzstd-dev \ + libpng16-16 \ + libpng-dev + +RUN curl -fLo jgrpp-$jgrpp_version.tar.gz https://github.com/JGRennison/OpenTTD-patches/archive/jgrpp-$jgrpp_version.tar.gz +RUN curl -fLo opengfx-$opengfx_version-all.zip https://cdn.openttd.org/opengfx-releases/$opengfx_version/opengfx-$opengfx_version-all.zip + +RUN tar -xvzf jgrpp-$jgrpp_version.tar.gz +RUN mkdir /tmp/build + +WORKDIR /tmp/build +RUN cmake \ + -B build \ + -D CMAKE_BUILD_TYPE=Release \ + -D CMAKE_INSTALL_PREFIX=/usr \ + -D CMAKE_INSTALL_BINDIR=bin \ + -D CMAKE_INSTALL_DATADIR=/usr/share \ + -D OPTION_DEDICATED=ON \ + -D DEFAULT_PERSONAL_DIR=/data \ + -G Ninja \ + -S /tmp/OpenTTD-patches-jgrpp-$jgrpp_version +RUN ninja -C build +RUN ninja -C build install + +WORKDIR /tmp +RUN unzip opengfx-$opengfx_version-all.zip +RUN mv opengfx-$opengfx_version.tar /usr/share/openttd/baseset/opengfx-$opengfx_version.tar + +FROM debian:stable +RUN apt-get update \ + && apt-get upgrade -y \ + && apt-get install -y \ + zlib1g \ + liblzma5 \ + liblzo2-2 \ + libzstd1 \ + libpng16-16 \ + && apt-get clean \ + && rm -rvf /var/lib/apt/lists/* /var/log/apt /var/log/dpkg.log +COPY --from=builder /usr/bin/openttd /usr/bin/openttd +COPY --from=builder /usr/share/openttd/ /usr/share/openttd/ +COPY --from=builder /usr/share/doc/openttd/ /usr/share/doc/openttd/ +COPY --from=builder /usr/share/man/man6/openttd.6.gz /usr/share/man/man6/openttd.6.gz +RUN useradd -ms /bin/sh -d /data openttd +USER openttd:openttd +EXPOSE 3979 +EXPOSE 3979/udp +WORKDIR /data +ENV XDG_DATA_HOME=/data +VOLUME ["/data"] +ENTRYPOINT ["/usr/bin/openttd"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3610919 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: "3.7" +networks: + external: + external: true + +services: + ottd: + build: ./ + container_name: ottd + networks: + - external + labels: + - "traefik.enable=false" + restart: always