Skip to content
Snippets Groups Projects
Unverified Commit 59728b9c authored by Sebastian Höffner's avatar Sebastian Höffner
Browse files

Splitting nginx into its own container.

parent 2015252f
No related branches found
No related tags found
No related merge requests found
FROM openjdk:latest
FROM openjdk:11-jdk
LABEL maintainer="Sebastian Höffner <shoeffner@tzi.de>"
LABEL description="A small webapp to parse sentences using the DiaSpace grammar (University of Bremen) with OpenCCG."
LABEL version="1.0"
LABEL version="2.0"
EXPOSE 80
# EXPOSE 80
ENV OPENCCG_HOME /openccg
ENV PATH "$OPENCCG_HOME/bin:$PATH"
ENV LD_LIBRARY_PATH "$OPENCCG_HOME/lib:$LD_LIBRARY_PATH"
COPY nginx.conf /etc/nginx/sites-available/occg
# Download and extract OpenCCG
RUN curl -o openccg-0.9.5.tgz https://datapacket.dl.sourceforge.net/project/openccg/openccg/openccg%20v0.9.5%20-%20deplen%2C%20kenlm%2C%20disjunctivizer/openccg-0.9.5.tgz \
&& tar zxf openccg-0.9.5.tgz \
......@@ -20,26 +18,18 @@ RUN curl -o openccg-0.9.5.tgz https://datapacket.dl.sourceforge.net/project/open
&& curl -O http://www.diaspace.uni-bremen.de/twiki/pub/DiaSpace/ReSources/english.zip \
&& unzip -d /english english.zip \
&& rm english.zip \
# Server software: python 3, nginx, uwsgi; TatSu to parse the OpenCCG output
# Server software: python 3, uwsgi; TatSu to parse the OpenCCG output
&& apt-get update \
&& apt-get install -y python3 python3-pip nginx \
&& pip3 install flask uwsgi tatsu \
# Configure nginx
&& ln -s /etc/nginx/sites-available/occg /etc/nginx/sites-enabled/occg \
&& rm /etc/nginx/sites-enabled/default
&& apt-get install -y python3 python3-pip \
&& pip3 install flask uwsgi tatsu
COPY app /app
COPY Makefile /Makefile
COPY OpenCCG.ebnf /OpenCCG.ebnf
# Create the custom TatSu parser
RUN make
# Run Flask app behind nginx
WORKDIR /app
CMD service nginx start \
&& uwsgi --socket /tmp/ccgapp.sock \
--uid www-data \
--manage-script-name \
--module ccgapp \
--callable app
CMD uwsgi --http :8080 \
--uid www-data \
--manage-script-name \
--module ccgapp \
--callable app \
--master
......@@ -5,5 +5,12 @@ services:
openccg:
build: .
nginx:
build:
dockerfile: nginx/Dockerfile
context: .
ports:
- "80:80"
depends_on:
- openccg
FROM nginx:1.15.5-alpine
LABEL maintainer="Sebastian Höffner <shoeffner@tzi.de>"
LABEL description="nginx instance to serve OpenCCG and the OpenCCG.ebnf"
LABEL version="1.0"
EXPOSE 80
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY OpenCCG.ebnf /OpenCCG.ebnf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
}
server {
listen 80;
location / {
include uwsgi_params;
uwsgi_pass unix:/tmp/ccgapp.sock;
proxy_pass http://openccg:8080/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /grammar {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment