Browse Source

Merge pull request #1 from qrkourier/brizandrew

Andrew Briz 6 years ago
parent
commit
a9b4a281af
No account linked to committer's email
6 changed files with 46 additions and 22 deletions
  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 View File

1
+2.7.13

+ 25 - 8
Dockerfile View File

1
 FROM ubuntu:16.04
1
 FROM ubuntu:16.04
2
 
2
 
3
 # Install dependencies
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
 # Non-privileged user
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
 USER audiogram
28
 USER audiogram
15
 WORKDIR /home/audiogram
29
 WORKDIR /home/audiogram
16
 
30
 
17
 # Clone repo
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
 WORKDIR /home/audiogram/audiogram
34
 WORKDIR /home/audiogram/audiogram
35
+#VOLUME /home/audiogram/audiogram
20
 
36
 
21
 # Install dependencies
37
 # Install dependencies
22
 RUN npm install
38
 RUN npm install
39
+CMD npm start

+ 11 - 12
INSTALL.md View File

111
 
111
 
112
 If you use [Docker](https://www.docker.com/products/docker), you can build an image from the included Dockerfile.
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
 ```sh
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
 ```sh
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
 ## AWS installation
135
 ## AWS installation

+ 1 - 1
audiogram/combine-frames.js View File

4
 
4
 
5
   // Raw ffmpeg command with standard mp4 setup
5
   // Raw ffmpeg command with standard mp4 setup
6
   // Some old versions of ffmpeg require -strict for the aac codec
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
   exec(cmd, cb);
9
   exec(cmd, cb);
10
 
10
 

+ 7 - 0
docker-compose.yml View File

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

+ 1 - 1
editor/css/editor.css View File

468
   -webkit-box-flex: 1;
468
   -webkit-box-flex: 1;
469
       -ms-flex-positive: 1;
469
       -ms-flex-positive: 1;
470
           flex-grow: 1;
470
           flex-grow: 1;
471
-  width: auto;
471
+  width: 20%;
472
   padding: 6px;
472
   padding: 6px;
473
   color: #666;
473
   color: #666;
474
   font-size: 16px;
474
   font-size: 16px;