Added running unciv in docker (#7031)

This commit is contained in:
haimlm 2022-06-01 22:21:56 +03:00 committed by GitHub
parent afce951724
commit 51e3349ecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 0 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
.git
Dockerfile
docker-compose.yml

32
Dockerfile Normal file
View File

@ -0,0 +1,32 @@
ARG ARG_COMPILE_BASE_IMAGE=accetto/ubuntu-vnc-xfce-opengl-g3
FROM $ARG_COMPILE_BASE_IMAGE as build
USER root
RUN apt update && \
apt upgrade -y && \
apt install --fix-broken -y wget curl default-jre default-jdk
WORKDIR /src
# Get dependencies
RUN wget -q -O packr-all-4.0.0.jar https://github.com/libgdx/packr/releases/download/4.0.0/packr-all-4.0.0.jar && \
wget -q -O jre-linux-64.tar.gz https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.11%2B9/OpenJDK11U-jre_x64_linux_hotspot_11.0.11_9.tar.gz
# https://nieldw.medium.com/caching-gradle-binaries-in-a-docker-build-when-using-the-gradle-wrapper-277c17e7dd22
# Get gradle distribution
COPY *.gradle gradle.* gradlew /src/
COPY gradle /src/gradle
WORKDIR /src
RUN ./gradlew --version
# Build unciv
COPY . /src/
RUN ./gradlew classes
RUN ./gradlew desktop:packrLinux64 --stacktrace --info --daemon --scan
RUN ./gradlew desktop:zipLinuxFilesForJar
FROM accetto/ubuntu-vnc-xfce-opengl-g3 as run
WORKDIR /home/headless/Desktop/
COPY --chown=1001:1001 --from=build /src/desktop/packr/* /usr/
COPY --chown=1001:1001 --from=build /src/desktop/packr/Unciv.jar /usr/share/Unciv/Unciv.jar
COPY --chown=1001:1001 --from=build /src/desktop/linuxFilesForJar/* /home/headless/Desktop/
RUN chmod +x Unciv.sh
USER 1001

View File

@ -125,5 +125,15 @@ Single player does not use this feature.
| [![](https://static.itch.io/images/badge.svg)](https://yairm210.itch.io/unciv) | [![](https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png)](https://play.google.com/store/apps/details?id=com.unciv.app) | [![](https://fdroid.gitlab.io/artwork/badge/get-it-on.png)](https://f-droid.org/en/packages/com.unciv.app/) | [![](https://flathub.org/assets/badges/flathub-badge-en.svg)](https://flathub.org/apps/details/io.github.yairm210.unciv) | [![](https://static.itch.io/images/badge.svg)](https://yairm210.itch.io/unciv) | [![](https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png)](https://play.google.com/store/apps/details?id=com.unciv.app) | [![](https://fdroid.gitlab.io/artwork/badge/get-it-on.png)](https://f-droid.org/en/packages/com.unciv.app/) | [![](https://flathub.org/assets/badges/flathub-badge-en.svg)](https://flathub.org/apps/details/io.github.yairm210.unciv)
|--- |--- |--- |--- | |--- |--- |--- |--- |
## Run with Docker
If you have docker and docker-compose installed, you can:
* Run ```$ docker-compose build && docker-compose up```
* Open http://localhost:6901/vnc.html?password=headless
And if you are using docker desktop:
* ```$ docker compose build && docker compose up```
* http://localhost:6901/vnc.html?password=headless
# [Credits and 3rd parties](docs/Credits.md) # [Credits and 3rd parties](docs/Credits.md)

8
docker-compose.yml Normal file
View File

@ -0,0 +1,8 @@
version: "3.6"
services:
unciv:
build: .
ports:
- "6901:6901"
- "5901:5901"
command: /home/headless/Desktop/Unciv.sh