diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 00000000..27e71787 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,32 @@ +name: Build Docker + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Build Docker image + run: | + docker build \ + . \ + --file Dockerfile \ + --tag amulet-editor:latest \ + --build-arg AMULET_VERSION=CUSTOM:git+https://github.com/Amulet-Team/Amulet-Map-Editor.git@${{ github.event.release.tag_name }} + + - name: Save Docker image to tar archive + run: | + docker save amulet-editor:latest -o amulet-editor.tar + + - name: Upload Release Asset + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release upload ${{ github.event.release.tag_name }} \ + amulet-editor.tar#Amulet-v${{ github.event.release.tag_name }}-docker.tar diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..51bbe240 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM python:3.9-bullseye +RUN apt-get update && apt install libgtk-3-dev dbus-x11 wget libnotify4 -y +RUN pip install --upgrade pip +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 +ARG AMULET_VERSION=RELEASE # defaults to the latest version if no arg is given in build command. +RUN if [ "$(echo "$AMULET_VERSION" | cut -c1-7)" = "CUSTOM:" ]; then \ + pip install "$(echo "$AMULET_VERSION" | cut -c8-)"; \ + elif [ "$AMULET_VERSION" = "RELEASE" ]; then \ + pip install --upgrade --upgrade-strategy eager amulet-map-editor; \ + elif [ "$AMULET_VERSION" = "BETA" ]; then \ + pip install --upgrade --upgrade-strategy eager amulet-map-editor>=0b0; \ + elif [ "$AMULET_VERSION" = "ALPHA" ]; then \ + pip install --upgrade --upgrade-strategy eager amulet-map-editor>=0a0; \ + else \ + pip install --upgrade --upgrade-strategy eager amulet-map-editor==$AMULET_VERSION; \ + fi +RUN apt-get install libSDL2-2.0 -y + +ENTRYPOINT [ "/usr/local/bin/python", "-m", "amulet_map_editor" ]