Procházet zdrojové kódy

Merge pull request #1 from qrkourier/brizandrew

Andrew Briz před 6 roky
rodič
revize
a9b4a281af
No account linked to committer's email
6 změnil soubory, kde provedl 46 přidání a 22 odebrání
  1. 1 0
      .python-version
  2. 25 8
      Dockerfile
  3. 11 12
      INSTALL.md
  4. 1 1
      audiogram/combine-frames.js
  5. 7 0
      docker-compose.yml
  6. 1 1
      editor/css/editor.css

+ 1 - 0
.python-version Zobrazit soubor

@@ -0,0 +1 @@
1
+2.7.13

+ 25 - 8
Dockerfile Zobrazit soubor

@@ -1,22 +1,39 @@
1 1
 FROM ubuntu:16.04
2 2
 
3 3
 # Install dependencies
4
-RUN apt-get update --yes && apt-get upgrade --yes
5
-RUN apt-get install git nodejs npm \
6
-libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev libpng-dev build-essential g++ \
7
-ffmpeg \
8
-redis-server --yes
4
+RUN apt-get --yes update && \
5
+    apt-get --yes upgrade
6
+RUN apt-get --yes install git \
7
+                          nodejs \
8
+                          npm \
9
+                          libcairo2-dev \
10
+                          libjpeg8-dev \
11
+                          libpango1.0-dev \
12
+                          libgif-dev \
13
+                          libpng-dev \
14
+                          build-essential \
15
+                          g++ \
16
+                          ffmpeg \
17
+                          redis-server
9 18
 
10
-RUN ln -s `which nodejs` /usr/bin/node
19
+RUN update-alternatives --install /usr/bin/node node $(which nodejs) 50
11 20
 
12 21
 # Non-privileged user
13
-RUN useradd -m audiogram
22
+ARG UID=1000
23
+RUN useradd --create-home \
24
+            --no-log-init \
25
+            --shell /bin/false \
26
+            --uid $UID \
27
+            audiogram
14 28
 USER audiogram
15 29
 WORKDIR /home/audiogram
16 30
 
17 31
 # Clone repo
18
-RUN git clone https://github.com/nypublicradio/audiogram.git
32
+RUN : breakcache0
33
+RUN git clone https://github.com/brizandrew/audiogram.git
19 34
 WORKDIR /home/audiogram/audiogram
35
+#VOLUME /home/audiogram/audiogram
20 36
 
21 37
 # Install dependencies
22 38
 RUN npm install
39
+CMD npm start

+ 11 - 12
INSTALL.md Zobrazit soubor

@@ -111,26 +111,25 @@ Installing these dependencies on Windows is an uphill battle.  If you're running
111 111
 
112 112
 If you use [Docker](https://www.docker.com/products/docker), you can build an image from the included Dockerfile.
113 113
 
114
-In addition to installing Docker, you'll need to install Git.  You can do this by installing [GitHub Desktop](https://desktop.github.com/).
114
+In addition to installing Docker, you may need to install Git.  You can do this by installing [GitHub Desktop](https://desktop.github.com/).
115 115
 
116
-You can clone the repo and build an image, or build it directly from the repo:
117
-
118
-```sh
119
-git clone https://github.com/nypublicradio/audiogram.git
120
-cd audiogram
121
-docker build -t audiogram .
122
-```
116
+Some operating systems e.g. Ubuntu provide a permission group "docker. You can join this group like `sudo usermod -aG docker $USER` and then it's not necessary to prepend every docker command with `sudo`. It's necessary to log out of the desktop session for this permission group change to take effect.
123 117
 
124
-or
118
+You can clone the repo and build an image, or build it directly from the repo:
125 119
 
120
+An ephemeral container image can be built and run like
126 121
 ```sh
127
-docker build -t audiogram https://github.com/nypublicradio/audiogram.git
122
+docker build -t audiogram https://github.com/brizandrew/audiogram.git
123
+docker run -p 8888:8888 audiogram
128 124
 ```
129 125
 
130
-Now you can run Audiogram in a container using that image:
126
+or you can clone the source code to obtain the service file for docker compose and run these commands once in order to always have the container running in the background and available at http://localhost:8888.
131 127
 
132 128
 ```sh
133
-docker run -p 8888:8888 -t -i audiogram
129
+git clone https://github.com/brizandrew/audiogram.git
130
+cd audiogram
131
+docker build -t audiogram .
132
+docker-compose up
134 133
 ```
135 134
 
136 135
 ## AWS installation

+ 1 - 1
audiogram/combine-frames.js Zobrazit soubor

@@ -4,7 +4,7 @@ function combineFrames(options, cb) {
4 4
 
5 5
   // Raw ffmpeg command with standard mp4 setup
6 6
   // Some old versions of ffmpeg require -strict for the aac codec
7
-  var cmd = "ffmpeg -r " + options.framesPerSecond + " -i \"" + options.framePath + "\" -i \"" + options.audioPath + "\" -c:v libx264 -c:a aac -strict experimental -shortest -pix_fmt yuv420p \"" + options.videoPath + "\"";
7
+  var cmd = "ffmpeg -r " + options.framesPerSecond + " -i \"" + options.framePath + "\" -i \"" + options.audioPath + "\" -c:v libx264 -c:a aac -strict experimental -shortest -pix_fmt yuv420p -vf 'scale=trunc(iw/2)*2:trunc(ih/2)*2' \"" + options.videoPath + "\"";
8 8
 
9 9
   exec(cmd, cb);
10 10
 

+ 7 - 0
docker-compose.yml Zobrazit soubor

@@ -0,0 +1,7 @@
1
+version: '2'
2
+services:
3
+  audiogram:
4
+    image: audiogram
5
+    ports:
6
+        - 8888:8888
7
+    restart: always

+ 1 - 1
editor/css/editor.css Zobrazit soubor

@@ -468,7 +468,7 @@ g.time line {
468 468
   -webkit-box-flex: 1;
469 469
       -ms-flex-positive: 1;
470 470
           flex-grow: 1;
471
-  width: auto;
471
+  width: 20%;
472 472
   padding: 6px;
473 473
   color: #666;
474 474
   font-size: 16px;