mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Dockerised env. 1.1.3 build scripts
This commit is contained in:
parent
f7787e5976
commit
581963a4af
8 changed files with 87 additions and 118 deletions
|
@ -1,53 +1,9 @@
|
||||||
compileFolder
|
node_modules/*
|
||||||
|
gitrev
|
||||||
Compiled source #
|
.git
|
||||||
###################
|
.gitignore
|
||||||
*.com
|
.npm
|
||||||
*.class
|
.nvmrc
|
||||||
*.dll
|
nodemon.json
|
||||||
*.exe
|
|
||||||
*.o
|
|
||||||
*.so
|
|
||||||
|
|
||||||
# Packages #
|
|
||||||
############
|
|
||||||
# it's better to unpack these files and commit the raw source
|
|
||||||
# git has its own built in compression methods
|
|
||||||
*.7z
|
|
||||||
*.dmg
|
|
||||||
*.gz
|
|
||||||
*.iso
|
|
||||||
*.jar
|
|
||||||
*.rar
|
|
||||||
*.tar
|
|
||||||
*.zip
|
|
||||||
|
|
||||||
# Logs and databases #
|
|
||||||
######################
|
|
||||||
*.log
|
|
||||||
*.sql
|
|
||||||
*.sqlite
|
|
||||||
|
|
||||||
# OS generated files #
|
|
||||||
######################
|
|
||||||
.DS_Store?
|
|
||||||
ehthumbs.db
|
|
||||||
Icon?
|
|
||||||
Thumbs.db
|
|
||||||
|
|
||||||
/node_modules/*
|
|
||||||
|
|
||||||
app.js
|
app.js
|
||||||
app/js/*
|
**/js/*
|
||||||
|
|
||||||
test/unit/js/*
|
|
||||||
test/acceptance/js/*
|
|
||||||
|
|
||||||
forever/
|
|
||||||
|
|
||||||
**.swp
|
|
||||||
|
|
||||||
# Redis cluster
|
|
||||||
**/appendonly.aof
|
|
||||||
**/dump.rdb
|
|
||||||
**/nodes.conf
|
|
||||||
|
|
22
services/document-updater/Dockerfile
Normal file
22
services/document-updater/Dockerfile
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
FROM node:6.9.5 as app
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
#wildcard as some files may not be in all repos
|
||||||
|
COPY package*.json npm-shrink*.json /app/
|
||||||
|
|
||||||
|
RUN npm install --quiet
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
|
|
||||||
|
RUN npm run compile:all
|
||||||
|
|
||||||
|
FROM node:6.9.5
|
||||||
|
|
||||||
|
COPY --from=app /app /app
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
USER node
|
||||||
|
|
||||||
|
CMD ["node","app.js"]
|
36
services/document-updater/Jenkinsfile
vendored
36
services/document-updater/Jenkinsfile
vendored
|
@ -9,34 +9,9 @@ pipeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Install') {
|
stage('Build') {
|
||||||
agent {
|
|
||||||
docker {
|
|
||||||
image 'node:6.9.5'
|
|
||||||
args "-v /var/lib/jenkins/.npm:/tmp/.npm -e HOME=/tmp"
|
|
||||||
reuseNode true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
// we need to disable logallrefupdates, else git clones
|
sh 'make build'
|
||||||
// during the npm install will require git to lookup the
|
|
||||||
// user id which does not exist in the container's
|
|
||||||
// /etc/passwd file, causing the clone to fail.
|
|
||||||
sh 'git config --global core.logallrefupdates false'
|
|
||||||
sh 'rm -rf node_modules'
|
|
||||||
sh 'npm install && npm rebuild'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Compile') {
|
|
||||||
agent {
|
|
||||||
docker {
|
|
||||||
image 'node:6.9.5'
|
|
||||||
reuseNode true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
sh 'npm run compile:all'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,12 +29,7 @@ pipeline {
|
||||||
|
|
||||||
stage('Package and publish build') {
|
stage('Package and publish build') {
|
||||||
steps {
|
steps {
|
||||||
sh 'echo ${BUILD_NUMBER} > build_number.txt'
|
sh 'make publish'
|
||||||
sh 'touch build.tar.gz' // Avoid tar warning about files changing during read
|
|
||||||
sh 'tar -czf build.tar.gz --exclude=build.tar.gz --exclude-vcs .'
|
|
||||||
withAWS(credentials:'S3_CI_BUILDS_AWS_KEYS', region:"${S3_REGION_BUILD_ARTEFACTS}") {
|
|
||||||
s3Upload(file:'build.tar.gz', bucket:"${S3_BUCKET_BUILD_ARTEFACTS}", path:"${JOB_NAME}/${BUILD_NUMBER}.tar.gz")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
# This file was auto-generated, do not edit it directly.
|
# This file was auto-generated, do not edit it directly.
|
||||||
# Instead run bin/update_build_scripts from
|
# Instead run bin/update_build_scripts from
|
||||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
# Version: 1.0.1
|
# Version: 1.1.3
|
||||||
|
|
||||||
BUILD_NUMBER ?= local
|
BUILD_NUMBER ?= local
|
||||||
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||||
PROJECT_NAME = document-updater
|
PROJECT_NAME = document-updater
|
||||||
DOCKER_COMPOSE_FLAGS ?= -f docker-compose.yml
|
DOCKER_COMPOSE_FLAGS ?= -f docker-compose.yml
|
||||||
DOCKER_COMPOSE := docker-compose ${DOCKER_COMPOSE_FLAGS}
|
DOCKER_COMPOSE := BUILD_NUMBER=$(BUILD_NUMBER) \
|
||||||
|
BRANCH_NAME=$(BRANCH_NAME) \
|
||||||
|
PROJECT_NAME=$(PROJECT_NAME) \
|
||||||
|
MOCHA_GREP=${MOCHA_GREP} \
|
||||||
|
docker-compose ${DOCKER_COMPOSE_FLAGS}
|
||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f app.js
|
rm -f app.js
|
||||||
|
@ -18,12 +23,20 @@ clean:
|
||||||
test: test_unit test_acceptance
|
test: test_unit test_acceptance
|
||||||
|
|
||||||
test_unit:
|
test_unit:
|
||||||
@[ -d test/unit ] && $(DOCKER_COMPOSE) run --rm test_unit -- ${MOCHA_ARGS} || echo "document-updater has no unit tests"
|
@[ ! -d test/unit ] && echo "document-updater has no unit tests" || $(DOCKER_COMPOSE) run --rm test_unit
|
||||||
|
|
||||||
test_acceptance: test_clean # clear the database before each acceptance test run
|
test_acceptance: test_clean test_acceptance_pre_run # clear the database before each acceptance test run
|
||||||
@[ -d test/acceptance ] && $(DOCKER_COMPOSE) run --rm test_acceptance -- ${MOCHA_ARGS} || echo "document-updater has no acceptance tests"
|
@[ ! -d test/acceptance ] && echo "document-updater has no acceptance tests" || $(DOCKER_COMPOSE) run --rm test_acceptance
|
||||||
|
|
||||||
test_clean:
|
test_clean:
|
||||||
$(DOCKER_COMPOSE) down -t 0
|
$(DOCKER_COMPOSE) down -v -t 0
|
||||||
|
|
||||||
|
test_acceptance_pre_run:
|
||||||
|
@[ ! -f test/acceptance/scripts/pre-run ] && echo "document-updater has no pre acceptance tests task" || $(DOCKER_COMPOSE) run --rm test_acceptance test/acceptance/scripts/pre-run
|
||||||
|
build:
|
||||||
|
docker build --pull --tag gcr.io/csh-gcdm-test/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) .
|
||||||
|
|
||||||
|
publish:
|
||||||
|
docker push gcr.io/csh-gcdm-test/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||||
|
|
||||||
.PHONY: clean test test_unit test_acceptance test_clean build publish
|
.PHONY: clean test test_unit test_acceptance test_clean build publish
|
||||||
|
|
|
@ -1,33 +1,32 @@
|
||||||
# This file was auto-generated, do not edit it directly.
|
# This file was auto-generated, do not edit it directly.
|
||||||
# Instead run bin/update_build_scripts from
|
# Instead run bin/update_build_scripts from
|
||||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
# Version: 1.0.1
|
# Version: 1.1.3
|
||||||
|
|
||||||
version: "2"
|
version: "2"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
test_unit:
|
test_unit:
|
||||||
image: node:6.9.5
|
image: gcr.io/csh-gcdm-test/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
|
||||||
volumes:
|
user: node
|
||||||
- .:/app
|
command: npm run test:unit:_run
|
||||||
working_dir: /app
|
|
||||||
entrypoint: npm run test:unit:_run
|
|
||||||
|
|
||||||
test_acceptance:
|
test_acceptance:
|
||||||
image: node:6.9.5
|
build: .
|
||||||
volumes:
|
image: gcr.io/csh-gcdm-test/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
|
||||||
- .:/app
|
|
||||||
working_dir: /app
|
|
||||||
environment:
|
environment:
|
||||||
REDIS_HOST: redis
|
REDIS_HOST: redis
|
||||||
MONGO_HOST: mongo
|
MONGO_HOST: mongo
|
||||||
|
POSTGRES_HOST: postgres
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
|
||||||
- mongo
|
- mongo
|
||||||
entrypoint: npm run test:acceptance:_run
|
- redis
|
||||||
|
user: node
|
||||||
|
command: npm run test:acceptance:_run
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
|
|
||||||
mongo:
|
mongo:
|
||||||
image: mongo:3.4
|
image: mongo:3.4
|
||||||
|
|
||||||
|
|
|
@ -1,33 +1,39 @@
|
||||||
# This file was auto-generated, do not edit it directly.
|
# This file was auto-generated, do not edit it directly.
|
||||||
# Instead run bin/update_build_scripts from
|
# Instead run bin/update_build_scripts from
|
||||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
# Version: 1.0.1
|
# Version: 1.1.3
|
||||||
|
|
||||||
version: "2"
|
version: "2"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
test_unit:
|
test_unit:
|
||||||
image: node:6.9.5
|
build: .
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
working_dir: /app
|
working_dir: /app
|
||||||
entrypoint: npm run test:unit
|
environment:
|
||||||
|
MOCHA_GREP: ${MOCHA_GREP}
|
||||||
|
command: npm run test:unit
|
||||||
|
user: node
|
||||||
|
|
||||||
test_acceptance:
|
test_acceptance:
|
||||||
image: node:6.9.5
|
build: .
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
|
working_dir: /app
|
||||||
environment:
|
environment:
|
||||||
REDIS_HOST: redis
|
REDIS_HOST: redis
|
||||||
MONGO_HOST: mongo
|
MONGO_HOST: mongo
|
||||||
|
POSTGRES_HOST: postgres
|
||||||
|
MOCHA_GREP: ${MOCHA_GREP}
|
||||||
|
user: node
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
|
||||||
- mongo
|
- mongo
|
||||||
working_dir: /app
|
- redis
|
||||||
entrypoint: npm run test:acceptance
|
command: npm run test:acceptance
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
|
|
||||||
mongo:
|
mongo:
|
||||||
image: mongo:3.4
|
image: mongo:3.4
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,12 @@
|
||||||
"execMap": {
|
"execMap": {
|
||||||
"js": "npm run start"
|
"js": "npm run start"
|
||||||
},
|
},
|
||||||
|
|
||||||
"watch": [
|
"watch": [
|
||||||
"app/coffee/",
|
"app/coffee/",
|
||||||
"app.coffee"
|
"app.coffee",
|
||||||
|
"config/"
|
||||||
],
|
],
|
||||||
"ext": "coffee"
|
"ext": "coffee"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
"url": "https://github.com/sharelatex/document-updater-sharelatex.git"
|
"url": "https://github.com/sharelatex/document-updater-sharelatex.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile:app": "coffee -o app/js -c app/coffee && coffee -c app.coffee",
|
"compile:app": "([ -e app/coffee ] && coffee $COFFEE_OPTIONS -o app/js -c app/coffee || echo 'No CoffeeScript folder to compile') && ( [ -e app.coffee ] && coffee $COFFEE_OPTIONS -c app.coffee || echo 'No CoffeeScript app to compile')",
|
||||||
"start": "npm run compile:app && node app.js",
|
"start": "npm run compile:app && node $NODE_APP_OPTIONS app.js",
|
||||||
"test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
|
"test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
|
||||||
"test:acceptance": "npm run compile:app && npm run compile:acceptance_tests && npm run test:acceptance:_run -- $@",
|
"test:acceptance": "npm run compile:app && npm run compile:acceptance_tests && npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
|
||||||
"test:unit:_run": "mocha --recursive --reporter spec $@ test/unit/js",
|
"test:unit:_run": "mocha --recursive --reporter spec $@ test/unit/js",
|
||||||
"test:unit": "npm run compile:app && npm run compile:unit_tests && npm run test:unit:_run -- $@",
|
"test:unit": "npm run compile:app && npm run compile:unit_tests && npm run test:unit:_run -- --grep=$MOCHA_GREP",
|
||||||
"compile:unit_tests": "[ -e test/unit ] && coffee -o test/unit/js -c test/unit/coffee || echo 'No unit tests to compile'",
|
"compile:unit_tests": "[ ! -e test/unit/coffee ] && echo 'No unit tests to compile' || coffee -o test/unit/js -c test/unit/coffee",
|
||||||
"compile:acceptance_tests": "[ -e test/acceptance ] && coffee -o test/acceptance/js -c test/acceptance/coffee || echo 'No acceptance tests to compile'",
|
"compile:acceptance_tests": "[ ! -e test/acceptance/coffee ] && echo 'No acceptance tests to compile' || coffee -o test/acceptance/js -c test/acceptance/coffee",
|
||||||
"compile:all": "npm run compile:app && npm run compile:unit_tests && npm run compile:acceptance_tests",
|
"compile:all": "npm run compile:app && npm run compile:unit_tests && npm run compile:acceptance_tests",
|
||||||
"nodemon": "nodemon --config nodemon.json"
|
"nodemon": "nodemon --config nodemon.json"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue