diff --git a/.github/workflows/build-and-publish-docker.yaml b/.github/workflows/build-and-publish-docker.yaml new file mode 100644 index 0000000..19afcf5 --- /dev/null +++ b/.github/workflows/build-and-publish-docker.yaml @@ -0,0 +1,35 @@ +name: Build and Publish Docker + +on: + workflow_dispatch: + inputs: + image: + default: "hldtux/ndevkit" + description: "Docker image name" + +jobs: + build: + name: ngdevkit ${{ github.event.inputs.image }} + runs-on: ubuntu-latest + environment: DockerHub + + steps: + + # Checkout + - name: Checkout repository + uses: actions/checkout@v4 + with: + lfs: true + path: . + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and Deploy + run: | + make IMAGE=${{ github.event.inputs.image }} -f Makefile.docker docker push + echo "https://hub.docker.com/r/${{ github.event.inputs.image }}" + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..691355a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM ubuntu:20.04 +ARG DEBIAN_FRONTEND=noninteractive +RUN apt update -y && apt install -y autoconf autoconf-archive automake gcc curl zip unzip \ +libsdl2-dev python3-pygame libreadline-dev git +# make sure you have src packages enabled for dependency information +RUN echo "deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted" > /etc/apt/sources.list.d/ngdevkit.list +RUN echo "deb-src http://archive.ubuntu.com/ubuntu/ focal universe" >> /etc/apt/sources.list.d/ngdevkit.list +RUN apt update -y +# install build-dependency packages +RUN export GCC_VERSION_PKG=`apt-cache depends gcc | awk '/Depends.*gcc/ {print $2}'` \ +&& echo "GCC_VERSION_PKG=$GCC_VERSION_PKG" \ +&& apt build-dep -y $GCC_VERSION_PKG \ +&& apt build-dep -y --arch-only sdcc +# optional: install GLEW for OpenGL+GLSL shaders in GnGeo +RUN apt install -y libglew-dev +# dependencies for the example ROMs +RUN apt install -y imagemagick sox libsox-fmt-mp3 + +## Building the toolchain +WORKDIR /ngdevkit +COPY . . +RUN autoreconf -iv \ +&& ./configure --prefix=$PWD/local \ +&& make \ +&& make install + +# ngdevkit-gngeo +RUN make shellinit >> ~/.bashrc \ No newline at end of file diff --git a/Makefile.docker b/Makefile.docker new file mode 100644 index 0000000..542d9df --- /dev/null +++ b/Makefile.docker @@ -0,0 +1,19 @@ +# Remote image +IMAGE=hldtux/ndevkit +# Local image +# make IMAGE=ndevkit -f Makefile.docker +# or +#IMAGE=ndevkit +TAG=latest +# Forcing amd64 arch +DOCKER_DEFAULT_PLATFORM=linux/amd64 + +docker: + docker build . -t ${IMAGE} + +shell: docker + docker run -it --rm -v `pwd`:/tmp/workdir -w /tmp/workdir ${IMAGE} bash + +push: + docker push ${IMAGE}:${TAG} + diff --git a/README-docker.md b/README-docker.md new file mode 100644 index 0000000..90db640 --- /dev/null +++ b/README-docker.md @@ -0,0 +1,25 @@ +# Building ngdevkit from source on any platform that supports Docker + +## Pre-requisite + +* Docker + +### Shell +The following command will let access the container that contains the embedded devkit and the current folder at /tmp/workdir. So, you will be able to make the build your on rom easily without any local dependency + +```shell +make -f Makefile.docker shell +``` + +### Push +To avoid waiting the image creating you can push the finished one as following + +```shell +make -f Makefile.docker USER= push +``` + +Congratulations! You are now ready to experiment with the devkit. +Please follow the [main README](README.md) for additional information +on how to download and build the example ROMs, run the emulator or +run the debugger. + diff --git a/README.md b/README.md index f7bc8da..b66ef54 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,12 @@ is now deprecated in favour of the native MSYS2 environment. Likewise, we no longer build nightly packages for MSYS2's mingw64 subsystem, ucrt64 is the only supported subsystem for ngdevkit. +#### Docker + +```shell +make -f Makefile.docker shell +``` + ### Build the included examples The devkit comes with a series of examples to demonstrate how to use @@ -134,6 +140,11 @@ For macOS, make sure you use brew's python3 and gmake: ./configure gmake +For any platform that supports docker + +```shell +make -f Makefile.docker shell +``` ### Running the emulator