summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
Diffstat (limited to 'docker')
-rw-r--r--docker/Dockerfile11
-rwxr-xr-xdocker/build.sh20
2 files changed, 31 insertions, 0 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 00000000..3bc11235
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,11 @@
+FROM ubuntu:20.04
+
+RUN dpkg --add-architecture i386 && \
+apt update && \
+DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends binutils-arm-none-eabi build-essential git libpng-dev wine wine32 && \
+rm -r /var/cache/apt/archives /var/lib/apt/lists
+
+# Run a persistent wineserver to avoid errors like
+# wine: a wine server seems to be running, but I cannot connect to it.
+RUN mkdir -p /root/.wine
+CMD /usr/lib/wine/wineserver32 -f -p
diff --git a/docker/build.sh b/docker/build.sh
new file mode 100755
index 00000000..1ce28543
--- /dev/null
+++ b/docker/build.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+set -eou pipefail
+
+PROJECT_NAME=${PROJECT_NAME:-pokediamond}
+PROJECT_PATH=${PROJECT_PATH:-$(dirname $(pwd))}
+
+# Build container image
+IMAGE_NAME=${IMAGE_NAME:-$PROJECT_NAME-image}
+docker build -t $IMAGE_NAME .
+
+# Start container and wine server
+CONTAINER_NAME=${CONTAINER_NAME:-$PROJECT_NAME}
+docker run -d -i --name $CONTAINER_NAME --rm -t -v $PROJECT_PATH:/$PROJECT_NAME -w /$PROJECT_NAME $IMAGE_NAME
+
+# Build selected project, always exit successfully to ensure container stops
+docker exec -i -t $CONTAINER_NAME make $@ || true
+
+# Exit the container and remove
+docker stop $CONTAINER_NAME