Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
update docker containers to node v8 (#1178)
Browse files Browse the repository at this point in the history
* update docker containers to node v8
  • Loading branch information
butlerx authored and DanielBrierton committed Nov 6, 2017
1 parent 9693b67 commit 38c38ae
Show file tree
Hide file tree
Showing 11 changed files with 8,095 additions and 31 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Expand Up @@ -4,18 +4,18 @@ jobs:
build:
working_directory: ~/cp-zen-platform
docker:
- image: nodesource/node:0.10.45
- image: node:8.4
environment:
NODE_ENV: testing
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
key: dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: Install npm zen
command: npm install
command: yarn
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run:
Expand All @@ -26,7 +26,7 @@ jobs:
fi
- run:
name: Tests
command: npm run test
command: yarn test
deploy:
working_directory: ~/cp-zen-platform
docker:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -50,3 +50,4 @@ web/locale/*
# Bower
web/public/components
.bower
.yarn.sha1
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

13 changes: 6 additions & 7 deletions Dockerfile
@@ -1,16 +1,15 @@
FROM mhart/alpine-node:0.10.48
FROM node:8-alpine
MAINTAINER butlerx <butlerx@notthe.cloud>
ARG DEP_VERSION=latest
RUN if [ "$SOURCE_BRANCH" = "staging" ]; then DEP_VERSION=staging; fi && \
apk add --update git make gcc g++ python && \
RUN apk add --update git make gcc g++ python && \
mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app/
RUN npm install && \
npm install cp-zen-frontend@$DEP_VERSION cp-translations@$DEP_VERSION && \
RUN yarn && \
yarn add cp-zen-frontend@"$DEP_VERSION" cp-translations@"$DEP_VERSION" && \
node_modules/.bin/bower install --allow-root && \
npm run build && \
yarn build && \
apk del make gcc g++ python && \
rm -rf /tmp/* /root/.npm /root/.node-gyp
EXPOSE 8000
CMD ["node", "service.js"]
CMD ["yarn", "start"]
2 changes: 1 addition & 1 deletion dev.Dockerfile
@@ -1,4 +1,4 @@
FROM mhart/alpine-node:0.10.48
FROM node:8-alpine
MAINTAINER butlerx <butlerx@notthe.cloud>
ENV NODE_ENV development
RUN apk add --update git python build-base && \
Expand Down
15 changes: 7 additions & 8 deletions docker-entrypoint.sh
@@ -1,16 +1,15 @@
#! /usr/bin/env sh
# Dont `set -e` as the post install is going to fail
set -e
cd /usr/src/app || exit
touch .pkg.sha1
OLD_SHA=$(cat .pkg.sha1)
NEW_SHA=$(sha1sum package.json)
touch .yarn.sha1
OLD_SHA=$(cat .yarn.sha1)
NEW_SHA=$(sha1sum yarn.lock)
if [ "$OLD_SHA" != "$NEW_SHA" ]; then
echo "$NEW_SHA" > .pkg.sha1
npm install
echo "$NEW_SHA" > .yarn.sha1
yarn
rm -rf node_modules/cp-translations
rm -rf node_modules/cp-zen-frontend
ln -s /usr/src/cp-translations node_modules/cp-translations
ln -s /usr/src/cp-zen-frontend node_modules/cp-zen-frontend
./node_modules/.bin/bower install --allow-root
fi
npm run dev
yarn dev
5 changes: 3 additions & 2 deletions lib/profiles.js
Expand Up @@ -3,7 +3,8 @@
var _ = require('lodash');
var cacheTimes = require('../web/config/cache-times');
var fs = require('fs');
var defaultImage = new Buffer(fs.readFileSync(__dirname + '/../web/public/img/avatars/avatar.png', 'base64'), 'base64');
var path = require('path');
var defaultImage = new Buffer(fs.readFileSync(path.join(__dirname, '/../web/public/img/avatars/avatar.png'), 'base64'), 'base64');
var auth = require('./authentications');

exports.register = function (server, options, next) {
Expand Down Expand Up @@ -94,7 +95,7 @@ exports.register = function (server, options, next) {
}
}, {
method: 'GET',
/* Note: some older profiles in nodebb still using the 1.0 route*/
/* Note: some older profiles in nodebb still using the 1.0 route */
path: '/api/1.0/profiles/{id}/avatar_img',
handler: handleAvatarImage,
config: {
Expand Down
3 changes: 1 addition & 2 deletions lib/users.js
Expand Up @@ -318,8 +318,7 @@ exports.register = function (server, options, next) {
}
}
}
}
]);
}]);

function handleLogin (target) {
return function (request, reply) {
Expand Down
4 changes: 2 additions & 2 deletions lib/validations/dojos.js
Expand Up @@ -24,10 +24,10 @@ module.exports = function () {
return Joi.string().regex(/^[a-z0-9_]{1,15}$/i).allow('').allow(null);
},
facebook: function () {
return Joi.string().regex(/^[a-z0-9\.]{1,}$/i).allow('').allow(null);
return Joi.string().regex(/^[a-z0-9.]{1,}$/i).allow('').allow(null);
},
linkedin: function () {
return Joi.string().regex(/^[a-z0-9\-]{1,}$/i).allow('').allow(null);
return Joi.string().regex(/^[a-z0-9-]{1,}$/i).allow('').allow(null);
},
uri: function () {
return Joi.alternatives().try(Joi.string().uri(), Joi.string());
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"migrate": "node_modules/.bin/migrate",
"start": "node service.js",
"postinstall": "bower install",
"postinstall": "bower install --allow-root",
"test": "./node_modules/.bin/gulp",
"jshint-check": "./node_modules/.bin/gulp jshint",
"lint-lib": "./node_modules/.bin/gulp semistandard",
Expand Down Expand Up @@ -82,7 +82,7 @@
"gulp-less": "3.1.0",
"gulp-ng-annotate": "2.0.0",
"gulp-qdom": "0.0.3",
"gulp-semistandard": "^0.2.2",
"gulp-semistandard": "^1.0.0",
"gulp-tap": "^0.1.3",
"gulp-uglify": "1.5.4",
"jshint": "^2.9.2",
Expand All @@ -98,7 +98,7 @@
"mocha": "1.20.1",
"nodemon": "1.11.0",
"pre-commit": "1.0.7",
"semistandard": "7.0.3",
"semistandard": "^11.0.0",
"supertest": "0.9.0"
},
"homepage": "https://github.com/CoderDojo/cp-zen-platform"
Expand Down

0 comments on commit 38c38ae

Please sign in to comment.