mirror of
https://github.com/wassname/talk.git
synced 2026-07-29 11:28:24 +08:00
@@ -6,6 +6,7 @@ WORKDIR /usr/src/app
|
||||
|
||||
# Setup the environment
|
||||
ENV PATH /usr/src/app/bin:$PATH
|
||||
ENV TALK_PORT 5000
|
||||
EXPOSE 5000
|
||||
|
||||
# Install app dependencies
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Talk
|
||||
# Talk [](https://circleci.com/gh/coralproject/talk)
|
||||
A commenting platform from The Coral Project. [https://coralproject.net](https://coralproject.net)
|
||||
|
||||
### Getting Started
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
/* This is the entrypoint for the Talk Platform server. */
|
||||
|
||||
// Initialize application framework.
|
||||
const express = require('express');
|
||||
const bodyParser = require('body-parser');
|
||||
const morgan = require('morgan');
|
||||
const path = require('path');
|
||||
|
||||
const app = express();
|
||||
|
||||
// Middleware declarations.
|
||||
app.use(morgan('dev'));
|
||||
app.use(bodyParser.json());
|
||||
|
||||
// API Routes.
|
||||
app.use('/api/v1', require('./routes/api'));
|
||||
app.use('/client/', express.static('./dist'));
|
||||
|
||||
// Static Routes.
|
||||
app.use('/client/', express.static(path.join(__dirname, 'dist')));
|
||||
|
||||
module.exports = app;
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
machine:
|
||||
node:
|
||||
version: 6
|
||||
services:
|
||||
- docker
|
||||
|
||||
test:
|
||||
override:
|
||||
- MOCHA_FILE=$CIRCLE_TEST_REPORTS/junit/test-results.xml ./node_modules/.bin/mocha tests --reporter mocha-junit-reporter
|
||||
- npm run lint
|
||||
|
||||
deployment:
|
||||
release:
|
||||
tag: /[0-9]+(\.[0-9]+)*/
|
||||
commands:
|
||||
- bash ./scripts/deploy.sh
|
||||
|
||||
latest:
|
||||
branch: master
|
||||
commands:
|
||||
- bash ./scripts/deploy.sh
|
||||
@@ -0,0 +1,24 @@
|
||||
version: '2'
|
||||
services:
|
||||
|
||||
talk:
|
||||
image: coralproject/talk:latest
|
||||
build: .
|
||||
restart: always
|
||||
ports:
|
||||
- "5000:5000"
|
||||
environment:
|
||||
- "TALK_PORT=5000"
|
||||
- "TALK_MONGO_URL=mongodb://mongo"
|
||||
depends_on:
|
||||
- mongo
|
||||
|
||||
mongo:
|
||||
image: mongo:3.2
|
||||
restart: always
|
||||
volumes:
|
||||
- mongo:/data/db
|
||||
|
||||
volumes:
|
||||
mongo:
|
||||
external: false
|
||||
+3
-1
@@ -44,7 +44,8 @@
|
||||
"body-parser": "^1.15.2",
|
||||
"debug": "^2.2.0",
|
||||
"express": "^4.14.0",
|
||||
"mongoose": "^4.6.5"
|
||||
"mongoose": "^4.6.5",
|
||||
"morgan": "^1.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "6.14.0",
|
||||
@@ -66,6 +67,7 @@
|
||||
"imports-loader": "^0.6.5",
|
||||
"json-loader": "^0.5.4",
|
||||
"mocha": "^3.1.2",
|
||||
"mocha-junit-reporter": "^1.12.1",
|
||||
"pre-git": "^3.10.0",
|
||||
"pym.js": "^1.1.1",
|
||||
"react": "15.3.2",
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
docker login -u $DOCKER_USER -p $DOCKER_PASS
|
||||
|
||||
# Sourced from https://segment.com/blog/ci-at-segment/
|
||||
|
||||
deploy_tag() {
|
||||
# Find our individual versions from the tags
|
||||
if [ -n "$(echo $CIRCLE_TAG | grep -E '.*\..*\..*')" ]
|
||||
then
|
||||
major=$(echo $CIRCLE_TAG | cut -d. -f1)
|
||||
minor=$(echo $CIRCLE_TAG | cut -d. -f2)
|
||||
patch=$(echo $CIRCLE_TAG | cut -d. -f3)
|
||||
|
||||
major_version_tag=$major
|
||||
minor_version_tag=$major.$minor
|
||||
patch_version_tag=$major.$minor.$patch
|
||||
|
||||
tag_list="$major_version_tag $minor_version_tag $patch_version_tag"
|
||||
else
|
||||
tag_list=$CIRCLE_TAG
|
||||
fi
|
||||
|
||||
# Tag the new image with major, minor and patch version tags.
|
||||
for version in $tag_list
|
||||
do
|
||||
echo "==> tagging $version"
|
||||
docker tag coralproject/talk:latest coralproject/talk:$version
|
||||
done
|
||||
|
||||
# Push each of the tags to docker hub, including latest
|
||||
for version in $tag_list latest
|
||||
do
|
||||
echo "==> pushing $version"
|
||||
docker push coralproject/talk:$version
|
||||
done
|
||||
}
|
||||
|
||||
deploy_latest() {
|
||||
echo "==> pushing latest"
|
||||
docker push coralproject/talk:latest
|
||||
}
|
||||
|
||||
# build the repo
|
||||
docker build -t coralproject/talk .
|
||||
|
||||
# deploy based on the env
|
||||
if [ -n "$CIRCLE_TAG" ]
|
||||
then
|
||||
deploy_tag
|
||||
else
|
||||
deploy_latest
|
||||
fi
|
||||
Reference in New Issue
Block a user