Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Setup Docker and modify to support it
  • Loading branch information
TheMrGong committed Jan 8, 2020
1 parent bfc0aeb commit bf12bf3
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
@@ -0,0 +1,4 @@
.gitignore
.dockerignore
dist/
node_modules/
3 changes: 2 additions & 1 deletion .gitignore
@@ -1 +1,2 @@
node_modules/
node_modules/
dist/
14 changes: 14 additions & 0 deletions Dockerfile
@@ -0,0 +1,14 @@
FROM ampervue/ffmpeg
FROM node:10.9.0

COPY --from=0 / /

WORKDIR /usr/src/app

COPY ./package.json /usr/src/app
COPY ./yarn.lock /usr/src/app

RUN yarn install
COPY . /usr/src/app

CMD ["yarn", "start"]
9 changes: 6 additions & 3 deletions package.json
Expand Up @@ -4,7 +4,10 @@
"description": "Allows for users to request a color for their name",
"main": "src/index.js",
"scripts": {
"start": "node src/index.js"
"prebuild": "rimraf dist",
"build": "babel src -d dist",
"dev": "export APP_ROOT=$PWD && nodemon --exec babel-node ./src/index.js",
"start": "export APP_ROOT=$PWD && yarn run build&& cd dist&& node index.js"
},
"repository": {
"type": "git",
Expand All @@ -25,7 +28,7 @@
},
"homepage": "https://github.com/TheMrGong/ColorRequsts#readme",
"dependencies": {
"canvas": "git+https://github.com/Automattic/node-canvas.git",
"canvas": "^2.6.0",
"discord.js": "^11.5.0",
"gif-frames": "^1.0.1",
"mysql": "^2.17.1",
Expand All @@ -41,4 +44,4 @@
"nodemon": "^1.19.4",
"rimraf": "^3.0.0"
}
}
}
4 changes: 2 additions & 2 deletions src/requests/requestimages.js
Expand Up @@ -22,8 +22,8 @@ const aliasPreviewProps = {
height: 200
}

canvasAPI.registerFont("./font/Whitney Medium.ttf", { family: "Whitney-Medium" })
canvasAPI.registerFont("./font/Whitney Book.ttf", { family: "Whitney-Book" })
canvasAPI.registerFont(process.env.APP_ROOT + "/font/Whitney Medium.ttf", { family: "Whitney-Medium" })
canvasAPI.registerFont(process.env.APP_ROOT + "/font/Whitney Book.ttf", { family: "Whitney-Book" })


const ACCEPT_EMOJI = "✅"
Expand Down
3 changes: 2 additions & 1 deletion src/util/graphics/ffmpegutil.js
Expand Up @@ -23,13 +23,14 @@ async function convertImagesToGif(fps, buffers, width, height) {
'-i',
'-',
'-lavfi',
`palettegen=reserve_transparent=0:stats_mode=diff[pal],[0:v][pal]paletteuse=dither=heckbert:new=1`,// Take a new pallette for each output frame
`palettegen=reserve_transparent=0:stats_mode=diff[pal],[0:v][pal]paletteuse=dither=heckbert`,// Take a new pallette for each output frame
'-f',
'gif',
'-r',
`${fps}`,
'pipe:1'
]) // uncomment for debugging

// ffmpeg.stderr.on("data", data => {
// console.log(data.toString())
// })
Expand Down

0 comments on commit bf12bf3

Please sign in to comment.