mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
add support for grunt build
This commit is contained in:
parent
a1ef47c7d1
commit
3e7595f3f2
5 changed files with 123 additions and 2 deletions
|
@ -14,16 +14,23 @@ RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharela
|
||||||
|
|
||||||
# Install ShareLaTeX
|
# Install ShareLaTeX
|
||||||
RUN apt-get install -y git python
|
RUN apt-get install -y git python
|
||||||
RUN git clone -b release https://github.com/sharelatex/sharelatex.git /var/www/sharelatex
|
RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex
|
||||||
RUN cd /var/www/sharelatex && git pull origin release
|
|
||||||
|
|
||||||
# zlib1g-dev is needed to compile the synctex binaries in the CLSI during `grunt install`.
|
# zlib1g-dev is needed to compile the synctex binaries in the CLSI during `grunt install`.
|
||||||
RUN apt-get install -y zlib1g-dev
|
RUN apt-get install -y zlib1g-dev
|
||||||
|
|
||||||
|
|
||||||
|
ADD services.js /var/www/sharelatex/config/services.js
|
||||||
|
ADD package.json /var/www/package.json
|
||||||
|
ADD git-revision.js /var/www/git-revision.js
|
||||||
|
RUN cd /var/www && npm install
|
||||||
|
|
||||||
RUN cd /var/www/sharelatex; \
|
RUN cd /var/www/sharelatex; \
|
||||||
npm install; \
|
npm install; \
|
||||||
grunt install;
|
grunt install;
|
||||||
|
|
||||||
|
RUN cd /var/www && node git-revision > revisions.txt
|
||||||
|
|
||||||
# Minify js assets
|
# Minify js assets
|
||||||
RUN cd /var/www/sharelatex/web; \
|
RUN cd /var/www/sharelatex/web; \
|
||||||
grunt compile:minify;
|
grunt compile:minify;
|
||||||
|
|
38
server-ce/Gruntfile.coffee
Normal file
38
server-ce/Gruntfile.coffee
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
services = require('./services')
|
||||||
|
|
||||||
|
module.exports = (grunt) ->
|
||||||
|
|
||||||
|
tag = grunt.option("tag") or 'latest'
|
||||||
|
repos = []
|
||||||
|
for service in services
|
||||||
|
url = service.repo.split('/')
|
||||||
|
owner = url[3]
|
||||||
|
repo = url[4].replace('.git','')
|
||||||
|
repos.push "/repos/#{owner}/#{repo}/git/refs/heads/#{service.version}"
|
||||||
|
|
||||||
|
grunt.initConfig
|
||||||
|
docker_io:
|
||||||
|
default_options:
|
||||||
|
options:
|
||||||
|
dockerFileLocation: '.'
|
||||||
|
buildName: 'sharelatex'
|
||||||
|
tag: grunt.option('tag') or 'latest'
|
||||||
|
push: grunt.option('push') or false
|
||||||
|
force: true
|
||||||
|
|
||||||
|
github:
|
||||||
|
combinedRevisions:
|
||||||
|
options:
|
||||||
|
#oAuth:
|
||||||
|
# access_token: ''
|
||||||
|
concat: true
|
||||||
|
src: repos
|
||||||
|
dest: 'version/' + tag + '.json'
|
||||||
|
|
||||||
|
grunt.loadNpmTasks 'grunt-docker-io'
|
||||||
|
grunt.loadNpmTasks 'grunt-github-api'
|
||||||
|
|
||||||
|
grunt.registerTask 'build', ['docker_io', 'github']
|
||||||
|
grunt.registerTask 'gitrev', ['github']
|
||||||
|
|
||||||
|
grunt.registerTask 'default', ['build']
|
22
server-ce/git-revision.js
Normal file
22
server-ce/git-revision.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
var simple = require('simple-git');
|
||||||
|
var services = require('./sharelatex/config/services');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
function print_latest(repoDir) {
|
||||||
|
git = simple(repoDir);
|
||||||
|
opt = [];
|
||||||
|
opt['max-count'] = 1;
|
||||||
|
git.log(opt, function(err, log) {
|
||||||
|
if (!err) {
|
||||||
|
console.log(repoDir + ',' + log.latest.hash);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
for (id in services) {
|
||||||
|
service = services[id];
|
||||||
|
dirPath = __dirname + '/sharelatex/'+service.name;
|
||||||
|
if (fs.existsSync(dirPath)) {
|
||||||
|
print_latest(dirPath);
|
||||||
|
}
|
||||||
|
}
|
11
server-ce/package.json
Normal file
11
server-ce/package.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"name": "none",
|
||||||
|
"author": "none",
|
||||||
|
"description": "none",
|
||||||
|
"dependencies": {
|
||||||
|
"grunt": "^0.4.5",
|
||||||
|
"grunt-docker-io": "^0.7.0",
|
||||||
|
"simple-git": "^1.32.1",
|
||||||
|
"grunt-github-api": "^0.2.3"
|
||||||
|
}
|
||||||
|
}
|
43
server-ce/services.js
Normal file
43
server-ce/services.js
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
module.exports =
|
||||||
|
|
||||||
|
[{
|
||||||
|
name: "web",
|
||||||
|
repo: "https://github.com/sharelatex/web-sharelatex.git",
|
||||||
|
version: "master"
|
||||||
|
}, {
|
||||||
|
name: "real-time",
|
||||||
|
repo: "https://github.com/sharelatex/real-time-sharelatex.git",
|
||||||
|
version: "master"
|
||||||
|
}, {
|
||||||
|
name: "document-updater",
|
||||||
|
repo: "https://github.com/sharelatex/document-updater-sharelatex.git",
|
||||||
|
version: "master"
|
||||||
|
}, {
|
||||||
|
name: "clsi",
|
||||||
|
repo: "https://github.com/sharelatex/clsi-sharelatex.git",
|
||||||
|
version: "master"
|
||||||
|
}, {
|
||||||
|
name: "filestore",
|
||||||
|
repo: "https://github.com/sharelatex/filestore-sharelatex.git",
|
||||||
|
version: "master"
|
||||||
|
}, {
|
||||||
|
name: "track-changes",
|
||||||
|
repo: "https://github.com/sharelatex/track-changes-sharelatex.git",
|
||||||
|
version: "master"
|
||||||
|
}, {
|
||||||
|
name: "docstore",
|
||||||
|
repo: "https://github.com/sharelatex/docstore-sharelatex.git",
|
||||||
|
version: "master"
|
||||||
|
}, {
|
||||||
|
name: "chat",
|
||||||
|
repo: "https://github.com/sharelatex/chat-sharelatex.git",
|
||||||
|
version: "master"
|
||||||
|
}, {
|
||||||
|
name: "tags",
|
||||||
|
repo: "https://github.com/sharelatex/tags-sharelatex.git",
|
||||||
|
version: "master"
|
||||||
|
}, {
|
||||||
|
name: "spelling",
|
||||||
|
repo: "https://github.com/sharelatex/spelling-sharelatex.git",
|
||||||
|
version: "master"
|
||||||
|
}]
|
Loading…
Reference in a new issue