Skip to content

Commit ca3ad8d

Browse files
Update Dockerfile (#1246)
* Update Dockerfile update to run on python 3.10 * Add script to build and run Docker container * Add dockerinfo.md with usage and compatibility info * Fix wxPython download link in Dockerfile * Add git installation to Dockerfile * Update AMULET_VERSION build argument in workflow * Move docker readme into main readme * Install Python 3.10 instead of Python 3 update to hardcode version of python to install. --------- Co-authored-by: gentlegiantJGC <[email protected]>
1 parent 58e5355 commit ca3ad8d

File tree

4 files changed

+46
-12
lines changed

4 files changed

+46
-12
lines changed

.github/workflows/docker-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
. \
1919
--file Dockerfile \
2020
--tag amulet-editor:latest \
21-
--build-arg AMULET_VERSION=CUSTOM:git+https://github.com/Amulet-Team/Amulet-Map-Editor.git@${{ github.event.release.tag_name }}
21+
--build-arg AMULET_VERSION=CUSTOM:git+https://github.com/${{ github.repository }}.git@${{ github.event.release.tag_name }}
2222
2323
- name: Save and compress Docker image
2424
run: |

Dockerfile

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,34 @@
1-
FROM python:3.9-bullseye
2-
RUN apt-get update && apt install libgtk-3-dev dbus-x11 wget libnotify4 -y
3-
RUN pip install --upgrade pip
4-
RUN wget https://extras.wxpython.org/wxPython4/extras/linux/gtk3/debian-11/wxPython-4.2.0-cp39-cp39-linux_x86_64.whl && pip install wxPython-4.2.0-cp39-cp39-linux_x86_64.whl
1+
FROM ubuntu:22.04
2+
3+
# Prevent interactive prompts during apt install
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
6+
# Install Python 3.10 (default on Ubuntu 22.04) and required dependencies
7+
RUN apt-get update && apt-get install -y \
8+
python3.10 \
9+
python3-pip \
10+
git \
11+
libgtk-3-dev \
12+
dbus-x11 \
13+
wget \
14+
libnotify4 \
15+
libSDL2-2.0 \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
RUN pip3 install --upgrade pip
19+
RUN wget https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04/wxpython-4.2.4-cp310-cp310-linux_x86_64.whl && pip3 install wxpython-4.2.4-cp310-cp310-linux_x86_64.whl
20+
521
ARG AMULET_VERSION=RELEASE # defaults to the latest version if no arg is given in build command.
622
RUN if [ "$(echo "$AMULET_VERSION" | cut -c1-7)" = "CUSTOM:" ]; then \
7-
pip install "$(echo "$AMULET_VERSION" | cut -c8-)"; \
23+
pip3 install "$(echo "$AMULET_VERSION" | cut -c8-)"; \
824
elif [ "$AMULET_VERSION" = "RELEASE" ]; then \
9-
pip install --upgrade --upgrade-strategy eager amulet-map-editor; \
25+
pip3 install --upgrade --upgrade-strategy eager amulet-map-editor; \
1026
elif [ "$AMULET_VERSION" = "BETA" ]; then \
11-
pip install --upgrade --upgrade-strategy eager amulet-map-editor>=0b0; \
27+
pip3 install --upgrade --upgrade-strategy eager amulet-map-editor>=0b0; \
1228
elif [ "$AMULET_VERSION" = "ALPHA" ]; then \
13-
pip install --upgrade --upgrade-strategy eager amulet-map-editor>=0a0; \
29+
pip3 install --upgrade --upgrade-strategy eager amulet-map-editor>=0a0; \
1430
else \
15-
pip install --upgrade --upgrade-strategy eager amulet-map-editor==$AMULET_VERSION; \
31+
pip3 install --upgrade --upgrade-strategy eager amulet-map-editor==$AMULET_VERSION; \
1632
fi
17-
RUN apt-get install libSDL2-2.0 -y
1833

19-
ENTRYPOINT [ "/usr/local/bin/python", "-m", "amulet_map_editor" ]
34+
ENTRYPOINT [ "/usr/bin/python3", "-m", "amulet_map_editor" ]

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ Extract the contained folder to a location on your computer and run the executab
2424
3) run `python -m pip install amulet-map-editor` to install the library and all its dependencies.
2525
4) run `python -m amulet_map_editor` to run the program
2626

27+
## Running with Docker (Linux)
28+
The Docker image runs on any Linux distro with Docker support.
29+
To run the Docker image, clone this repository and run `rundocker.sh`.
30+
Compatibility with wayland is done through xwayland for x11 support.
31+
2732
### Notes
2833

2934
If you have python 2 installed `python` may point to the wrong version in which case you will have to swap out `python` for `python3`

rundocker.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
docker build -t amulet-editor .
4+
5+
xhost +local:docker
6+
7+
docker run -it --rm \
8+
-e DISPLAY=$DISPLAY \
9+
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
10+
--device /dev/dri \
11+
--network=host \
12+
amulet-editor
13+
14+
xhost -local:docker

0 commit comments

Comments
 (0)