don't default to app volume mount; create s3 bucket on boot; fix revAll gulp step
This commit is contained in:
parent
03059b67f1
commit
820203625c
@ -11,7 +11,6 @@ RUN npm install -g --save-dev gulp
|
|||||||
|
|
||||||
COPY . /usr/src/app
|
COPY . /usr/src/app
|
||||||
RUN gulp styles
|
RUN gulp styles
|
||||||
|
|
||||||
RUN npm cache clean
|
RUN npm cache clean
|
||||||
|
|
||||||
CMD [ "npm", "start" ]
|
CMD [ "npm", "start" ]
|
||||||
|
@ -12,10 +12,9 @@ var uglify = require('gulp-uglify');
|
|||||||
var fingerprint = require('gulp-fingerprint');
|
var fingerprint = require('gulp-fingerprint');
|
||||||
var rev = require('gulp-rev');
|
var rev = require('gulp-rev');
|
||||||
|
|
||||||
var RevAll = require('gulp-rev-all');
|
var revAll = require('gulp-rev-all');
|
||||||
|
|
||||||
gulp.task('rev', () => {
|
gulp.task('rev', () => {
|
||||||
var revAll = new RevAll();
|
|
||||||
return gulp.src(['public/**'])
|
return gulp.src(['public/**'])
|
||||||
.pipe(gulp.dest('build/assets'))
|
.pipe(gulp.dest('build/assets'))
|
||||||
.pipe(revAll.revision())
|
.pipe(revAll.revision())
|
||||||
|
2
app.js
2
app.js
@ -47,7 +47,7 @@ swig.setFilter('cdn', function(input, idx) {
|
|||||||
app.engine('html', swig.renderFile);
|
app.engine('html', swig.renderFile);
|
||||||
app.set('view engine', 'html');
|
app.set('view engine', 'html');
|
||||||
|
|
||||||
if (app.get('env') != 'development') {
|
if (isProduction) {
|
||||||
app.set('views', path.join(__dirname, 'build', 'views'));
|
app.set('views', path.join(__dirname, 'build', 'views'));
|
||||||
app.use(favicon(path.join(__dirname, 'build', 'assets', 'images', 'favicon.png')));
|
app.use(favicon(path.join(__dirname, 'build', 'assets', 'images', 'favicon.png')));
|
||||||
app.use(express.static(path.join(__dirname, 'build', 'assets')));
|
app.use(express.static(path.join(__dirname, 'build', 'assets')));
|
||||||
|
@ -19,7 +19,7 @@ services:
|
|||||||
- MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
- MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
||||||
build: .
|
build: .
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/usr/src/app
|
# - ./:/usr/src/app
|
||||||
- /usr/src/app/node_modules
|
- /usr/src/app/node_modules
|
||||||
command: npm start
|
command: npm start
|
||||||
ports:
|
ports:
|
||||||
@ -31,4 +31,4 @@ services:
|
|||||||
links:
|
links:
|
||||||
- storage
|
- storage
|
||||||
- db
|
- db
|
||||||
- sync
|
- sync
|
||||||
|
@ -24,11 +24,16 @@ const s3 = new AWS.S3({
|
|||||||
endpoint: ep
|
endpoint: ep
|
||||||
});
|
});
|
||||||
|
|
||||||
|
s3.createBucket({
|
||||||
|
Bucket: config.get("storage_bucket"),
|
||||||
|
ACL: "public-read",
|
||||||
|
GrantRead: "*"
|
||||||
|
}, (err,res) => {
|
||||||
|
console.log("createBucket",err,res);
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
removeFile: (path, callback) => {
|
removeFile: (path, callback) => {
|
||||||
// const s3 = new AWS.S3({
|
|
||||||
// region: 'eu-central-1'
|
|
||||||
// });
|
|
||||||
const bucket = config.get("storage_bucket");
|
const bucket = config.get("storage_bucket");
|
||||||
s3.deleteObject({
|
s3.deleteObject({
|
||||||
Bucket: bucket, Key: path
|
Bucket: bucket, Key: path
|
||||||
@ -57,11 +62,6 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
fileStream.on('open', function () {
|
fileStream.on('open', function () {
|
||||||
// FIXME
|
|
||||||
// var s3 = new AWS.S3({
|
|
||||||
// region: 'eu-central-1'
|
|
||||||
// });
|
|
||||||
|
|
||||||
s3.putObject({
|
s3.putObject({
|
||||||
Bucket: bucket,
|
Bucket: bucket,
|
||||||
Key: fileName,
|
Key: fileName,
|
||||||
|
Loading…
Reference in New Issue
Block a user