From d9bdc734e178f62c2d97d5dae9345a4f5ea18907 Mon Sep 17 00:00:00 2001
From: Jakob Moser <moser@cl.uni-heidelberg.de>
Date: Tue, 8 Mar 2022 13:01:08 +0100
Subject: [PATCH] Add entrypoint to run within Docker

---
 entrypoint.sh | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 entrypoint.sh

diff --git a/entrypoint.sh b/entrypoint.sh
new file mode 100644
index 0000000..001f613
--- /dev/null
+++ b/entrypoint.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+#
+# Entrypoint for the xle Docker image.
+# 
+# - /grammar.lfg contains the grammar
+# - $1 contains the sentence to be parsed (passed as parameter)
+
+# Write xlerc containing instructions to parse
+echo "create-parser /grammar.lfg" > xlerc
+echo "parse { $1 }" >> xlerc
+
+# Start X server in background, wait to ensure it has started properly
+Xvfb :123 &
+sleep 1
+
+# Configure apps to use this X server
+export DISPLAY=:123
+
+# Start XLE, this will automatically load xlerc, wait until it has started and the parse is completed
+xle &
+sleep 3
+
+# Take a screenshot of the entire screen and store it
+import -window root /output/screenshot.png
-- 
GitLab