From 687e2c502df0f90d277b4c7eca46890cd817535c Mon Sep 17 00:00:00 2001
From: Guillaume Samson <guillaume.samson@softwareheritage.org>
Date: Mon, 13 Mar 2023 16:26:30 +0000
Subject: [PATCH] Add software-stories app

Related to swh/infra/sysadm-environment#4805
---
 apps/software-stories/Dockerfile    | 22 ++++++++++++++++++++++
 apps/software-stories/entrypoint.sh | 14 ++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 apps/software-stories/Dockerfile
 create mode 100644 apps/software-stories/entrypoint.sh

diff --git a/apps/software-stories/Dockerfile b/apps/software-stories/Dockerfile
new file mode 100644
index 000000000..078e3d502
--- /dev/null
+++ b/apps/software-stories/Dockerfile
@@ -0,0 +1,22 @@
+FROM node:19-bullseye
+
+RUN apt-get -y update && \
+    apt-get -y upgrade && \
+    npm install -g serve && \
+    mkdir -p /opt/swh/swh-stories && \
+    chown -R node:node /opt/swh
+
+USER node
+ENV NODE_OPTIONS=--openssl-legacy-provider
+WORKDIR /opt/swh/swh-stories
+
+COPY --chown=node:node entrypoint.sh /opt/swh
+
+RUN chmod u+x /opt/swh/entrypoint.sh && \
+    git clone https://github.com/ScienceStories/swh-stories.git /opt/swh/swh-stories && \
+    git checkout 04168585b48edb77b3410cfe0e5e06af545bb18c && \
+    rm package-lock.json && \
+    npm install --no-audit && \
+    npm run build
+
+ENTRYPOINT "/opt/swh/entrypoint.sh"
diff --git a/apps/software-stories/entrypoint.sh b/apps/software-stories/entrypoint.sh
new file mode 100644
index 000000000..fc0fdc7ea
--- /dev/null
+++ b/apps/software-stories/entrypoint.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+set -e
+
+case "$1" in
+  "shell")
+    shift
+    echo "Running command $@"
+    exec bash -i "$@"
+    ;;
+  *)
+    exec serve -s build
+    ;;
+esac
-- 
GitLab