浏览代码

init opt_unicraft for box

Vladislav Medov 3 年之前
当前提交
c5f1ad2ec2
共有 4 个文件被更改,包括 56 次插入0 次删除
  1. 20 0
      build_image.sh
  2. 10 0
      config.json
  3. 22 0
      docker/Dockerfile
  4. 4 0
      docker/entrypoint.sh

+ 20 - 0
build_image.sh

@@ -0,0 +1,20 @@
+#!/bin/bash
+
+IMAGE_NAME=$1
+IMAGE_VERSION=$2
+
+mkdir $IMAGE_NAME
+cd $IMAGE_NAME
+git clone gogs@gogs.unicraft.org:unicraft/$IMAGE_NAME.git .
+git checkout master
+git pull
+git checkout $IMAGE_VERSION
+git submodule update --init --recursive
+cd -
+mkdir $(pwd)/docker/current
+mount --bind $(pwd)/$IMAGE_NAME $(pwd)/docker/current
+docker build -t $IMAGE_NAME:$IMAGE_VERSION $(pwd)/docker || true
+umount $(pwd)/docker/current
+rm -Rf $(pwd)/docker/current
+rm -Rf $IMAGE_NAME
+

+ 10 - 0
config.json

@@ -0,0 +1,10 @@
+{
+	"auths": {
+		"registry.unicraft.org": {
+			"auth": "c3lzdGVtOkEwWVRNNU5UTmtaalF6TWpaaFltTmlPVFpqWlRreg=="
+		}
+	},
+	"HttpHeaders": {
+		"User-Agent": "Docker-Client/19.03.5 (linux)"
+	}
+}

+ 22 - 0
docker/Dockerfile

@@ -0,0 +1,22 @@
+FROM registry.unicraft.org/node:8-update
+
+RUN mkdir -p /ulearn && mkdir -p /lms_resources && mkdir -p /ulearn/.uclms && mkdir -p /ulearn/.pm2 && chmod 0777 / && chmod -R 0777 /ulearn
+RUN for i in `nawk 'BEGIN{ for(i=2000;i<=2200;i++) print i}'`; do groupadd --gid $i user$i; useradd -d /ulearn -u $i -g $i user$i; usermod -G ulearn,user$i user$i; done
+RUN apt-get update
+RUN apt-get -y install chinese*
+#RUN yarn global add pm2
+RUN npm install -g pm2@4.2.1
+WORKDIR /ulearn
+COPY current/ ./
+COPY entrypoint.sh .
+
+RUN yarn install --ignore-engines 
+#RUN yarn upgrade @ckeditor/ckeditor5-build-classic --ignore-engines
+RUN npm run compile && chown -R root:ulearn build && chmod -R ga+w build
+
+#RUN find . -not -name '.' -not -name '..' -not -name 'entrypoint.sh' -not -name 'build.server.js' -not -name 'ecosystem.json' -not -path './build*' -not -path './node_modules*' -not -path './resources*'  -not -path './i18n*' -exec rm -Rf {} +
+
+EXPOSE 23000
+# ENV HOME=/ulearn
+
+CMD ["/ulearn/entrypoint.sh"]

+ 4 - 0
docker/entrypoint.sh

@@ -0,0 +1,4 @@
+#!/bin/sh
+
+pm2-runtime start ecosystem.json
+