Skip to content

Commit

Permalink
feat(docker): switch to node:dubnium-stretch-slim for a faster and mo…
Browse files Browse the repository at this point in the history
…re modern docker build
  • Loading branch information
Algram committed Apr 22, 2019
1 parent 036a1ee commit 473155a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
18 changes: 6 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
#
# Dockerfile for ytdl-webserver
#
FROM ubuntu:16.04
FROM node:dubnium-stretch-slim

WORKDIR /home/app

RUN apt-get update \
&& apt-get install -y curl ffmpeg \
&& curl -sL https://deb.nodesource.com/setup_10.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm@latest \
RUN apt update \
&& apt install -y curl ffmpeg \
&& rm -rf /var/lib/apt/lists/*

# This is on a separate line because youtube-dl needs to be frequently updated
RUN apt-get update \
&& apt-get install -y youtube-dl \
RUN apt update \
&& apt install -y youtube-dl \
&& rm -rf /var/lib/apt/lists/*

# only install node_modules if the package.json changes
# Only install node_modules if the package.json changes
COPY package.json package-lock.json ./
RUN npm ci

Expand Down
6 changes: 3 additions & 3 deletions src/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const provision = async () => {
server.route({
method: 'POST',
path: '/download',
handler: (request, reply) => {
handler: (request) => {
const url = request.payload.url
const options = {
path: path.join(__dirname, '../../public/temp'),
Expand All @@ -53,9 +53,9 @@ const provision = async () => {
server.route({
method: 'GET',
path: '/request/{video}',
handler: (request, reply) => {
handler: (request, h) => {
const videoName = encodeURIComponent(request.params.video)
reply.file(path.join('temp', decodeURIComponent(videoName)))
return h.file(path.join('temp', decodeURIComponent(videoName)))
}
})

Expand Down

0 comments on commit 473155a

Please sign in to comment.