don't default to app volume mount; create s3 bucket on boot; fix revAll gulp step

This commit is contained in:
Lukas F. Hartmann 2017-04-07 18:01:23 +02:00
parent 03059b67f1
commit 820203625c
5 changed files with 12 additions and 14 deletions

View File

@ -11,7 +11,6 @@ RUN npm install -g --save-dev gulp
COPY . /usr/src/app
RUN gulp styles
RUN npm cache clean
CMD [ "npm", "start" ]

View File

@ -12,10 +12,9 @@ var uglify = require('gulp-uglify');
var fingerprint = require('gulp-fingerprint');
var rev = require('gulp-rev');
var RevAll = require('gulp-rev-all');
var revAll = require('gulp-rev-all');
gulp.task('rev', () => {
var revAll = new RevAll();
return gulp.src(['public/**'])
.pipe(gulp.dest('build/assets'))
.pipe(revAll.revision())

2
app.js
View File

@ -47,7 +47,7 @@ swig.setFilter('cdn', function(input, idx) {
app.engine('html', swig.renderFile);
app.set('view engine', 'html');
if (app.get('env') != 'development') {
if (isProduction) {
app.set('views', path.join(__dirname, 'build', 'views'));
app.use(favicon(path.join(__dirname, 'build', 'assets', 'images', 'favicon.png')));
app.use(express.static(path.join(__dirname, 'build', 'assets')));

View File

@ -19,7 +19,7 @@ services:
- MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
build: .
volumes:
- ./:/usr/src/app
# - ./:/usr/src/app
- /usr/src/app/node_modules
command: npm start
ports:

View File

@ -24,11 +24,16 @@ const s3 = new AWS.S3({
endpoint: ep
});
s3.createBucket({
Bucket: config.get("storage_bucket"),
ACL: "public-read",
GrantRead: "*"
}, (err,res) => {
console.log("createBucket",err,res);
});
module.exports = {
removeFile: (path, callback) => {
// const s3 = new AWS.S3({
// region: 'eu-central-1'
// });
const bucket = config.get("storage_bucket");
s3.deleteObject({
Bucket: bucket, Key: path
@ -57,11 +62,6 @@ module.exports = {
}
});
fileStream.on('open', function () {
// FIXME
// var s3 = new AWS.S3({
// region: 'eu-central-1'
// });
s3.putObject({
Bucket: bucket,
Key: fileName,