Skip to content

Instantly share code, notes, and snippets.

@testpilot031
Last active June 21, 2018 04:25
Show Gist options
  • Save testpilot031/e4ef33e2eb841031715977e1e723496d to your computer and use it in GitHub Desktop.
Save testpilot031/e4ef33e2eb841031715977e1e723496d to your computer and use it in GitHub Desktop.
docker for yang-explorer
# build:docker build -t yangb .
# run & bash:docker run docker run -p 80:80 -p 100:100 -it XXXXX /bin/bash
#
FROM ubuntu:17.10
RUN set -x && \
    apt update && \
    apt install -y vim git sudo mlocate lsof python-pip python-dev libffi-dev libssl-dev  && \
    apt install -y graphviz && \
    apt install -y libxml2-dev libxslt1-dev python-dev zlib1g-dev && \
    apt install -y virtualenv && \
    pip install pyang
    #pip install --upgrade pip
RUN git clone https://github.com/CiscoDevNet/yang-explorer.git && \
    cd yang-explorer && \
    bash setup.sh -y
RUN updatedb && apt install -y nginx tcpdump curl
RUN echo -e "server {\nlisten *:8080;\nlocation / {\nproxy_set_header X-Forwarded-Host \$host;\nproxy_set_header X-Forwarded-Server \$host;\nproxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;\nproxy_pass http://localhost:8088;\n}\n}" > /etc/nginx/conf.d/r-proxy-server.conf
ENTRYPOINT tail -f /dev/null && service nginx start

Ubuntu17.10

apt install nginx
vi /etc/nginx/conf.d/reverse-proxy-server.conf
server {
                listen *:80;
                location / {
                    proxy_set_header X-Forwarded-Host $host;
                    proxy_set_header X-Forwarded-Server $host;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_pass http://localhost:8088;
                }
        }

for Docker

FROM ubuntu:17.10
RUN apt update
RUN apt install -y nginx
RUN echo -e "server {\nlisten *:8080;\nlocation / {\nproxy_set_header X-Forwarded-Host \$host;\nproxy_set_header X-Forwarded-Server \$host;\nproxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;\nproxy_pass http://localhost:8088;\n}\n}" > /etc/nginx/conf.d/r-proxy-server.conf
ENTRYPOINT tail -f /dev/null && service nginx start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment