mirror of
https://github.com/wassname/talk.git
synced 2026-06-27 19:33:06 +08:00
added revision hash
This commit is contained in:
@@ -15,6 +15,10 @@ COPY . /usr/src/app
|
||||
# Ensure the runtime of the container is in production mode.
|
||||
ENV NODE_ENV production
|
||||
|
||||
# Store the current git revision.
|
||||
ARG REVISION_HASH
|
||||
ENV REVISION_HASH=${REVISION_HASH}
|
||||
|
||||
# Install app dependencies and build static assets.
|
||||
RUN yarn global add node-gyp && \
|
||||
yarn install --frozen-lockfile && \
|
||||
|
||||
@@ -55,6 +55,10 @@ const CONFIG = {
|
||||
? process.env.TALK_LOGGING_LEVEL
|
||||
: 'info',
|
||||
|
||||
// REVISION_HASH when using the docker build will contain the build hash that
|
||||
// it was built at.
|
||||
REVISION_HASH: process.env.REVISION_HASH,
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// JWT based configuration
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
const express = require('express');
|
||||
const pkg = require('../../../package.json');
|
||||
const { version } = require('../../../package.json');
|
||||
const { REVISION_HASH } = require('../../../config');
|
||||
const router = express.Router();
|
||||
|
||||
// Return the current version.
|
||||
router.get('/', (req, res) => {
|
||||
res.json({ version: pkg.version });
|
||||
res.json({ version, revision: REVISION_HASH });
|
||||
});
|
||||
|
||||
router.use('/account', require('./account'));
|
||||
|
||||
+10
-3
@@ -54,9 +54,16 @@ deploy_branch() {
|
||||
docker push coralproject/talk:$CIRCLE_BRANCH-onbuild
|
||||
}
|
||||
|
||||
ARGS=""
|
||||
|
||||
if [[ -n "$CIRCLE_SHA1" ]]
|
||||
then
|
||||
ARGS="--build-arg REVISION_HASH=${CIRCLE_SHA1}"
|
||||
fi
|
||||
|
||||
# build the repo, including the onbuild tagged versions.
|
||||
docker build -t coralproject/talk:latest -f Dockerfile .
|
||||
docker build -t coralproject/talk:latest-onbuild -f Dockerfile.onbuild .
|
||||
docker build -t coralproject/talk:latest ${ARGS} -f Dockerfile .
|
||||
docker build -t coralproject/talk:latest-onbuild ${ARGS} -f Dockerfile.onbuild .
|
||||
|
||||
if [ "$1" = "deploy" ]
|
||||
then
|
||||
@@ -80,4 +87,4 @@ then
|
||||
deploy_branch
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user