Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
FROM alpine:3.7
FROM nginx:stable-alpine

# Install nginx and ffmpeg
# Install ffmpeg and configure nginx
RUN apk add --update nginx ffmpeg && rm -rf /var/cache/apk/* && mkdir /tmp/stream
COPY nginx/nginx.conf /etc/nginx/nginx.conf

# =================================================================================
# Fix up permissions for OpenShift (non-root Docker user)
# ref: https://torstenwalter.de/openshift/nginx/2017/08/04/nginx-on-openshift.html
# - Make sure nginx can read and write it's working directories.
# - The container dynamically configures nginx on startup
# - The application artifacts live in /tmp
# ---------------------------------------------------------------------------------
RUN chmod g+rw /var/run \
/var/log/nginx \
/etc/nginx/nginx.conf \
/tmp \
/tmp/stream
# =================================================================================

COPY ./startup.sh /
COPY ./create_ffmpeg_cmd.sh /
RUN ["chmod", "+x", "/startup.sh"]
Expand Down
14 changes: 11 additions & 3 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
user nginx;
# user nginx; # Removed due to OpenShift running as non-root
worker_processes auto;

error_log /var/log/nginx/error.log warn;
# error_log /var/log/nginx/error.log warn;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
Expand All @@ -16,8 +17,15 @@ http {

access_log /var/log/nginx/access.log;

# Fix Filepath issues on OpenShift by forcing everything into /tmp
client_body_temp_path /tmp/nginx 1 2;
proxy_temp_path /tmp/nginx-proxy;
fastcgi_temp_path /tmp/nginx-fastcgi;
uwsgi_temp_path /tmp/nginx-uwsgi;
scgi_temp_path /tmp/nginx-scgi;

server {
listen 80;
listen 8080;

location / {
# Disable cache
Expand Down