欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

docker install openresty and python and grafana 博客分类: docker  

程序员文章站 2024-03-19 20:36:16
...
#FROM debian:stretch-slim
#FROM cnshdocker.sh.cn.ao.ericsson.se/cgc_sep/ubuntu
FROM ubuntu:14.04

ARG GRAFANA_URL="https://s3-us-west-2.amazonaws.com/grafana-releases/master/grafana-latest.linux-x64.tar.gz"
ARG GF_UID="472"
ARG GF_GID="472"

ENV https_proxy=http://10.175.250.81:8080/
ENV http_proxy=http://10.175.250.81:8080/

#ENV http_proxy=http://www-proxy.lmera.ericsson.se:8080
#ENV https_proxy=http://www-proxy.lmera.ericsson.se:8080

ENV PATH=/usr/share/grafana/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
    GF_PATHS_CONFIG="/etc/grafana/grafana.ini" \
    GF_PATHS_DATA="/var/lib/grafana" \
    GF_PATHS_HOME="/usr/share/grafana" \
    GF_PATHS_LOGS="/var/log/grafana" \
    GF_PATHS_PLUGINS="/var/lib/grafana/plugins" \
    GF_PATHS_PROVISIONING="/etc/grafana/provisioning"

RUN apt-get update && apt-get install -qq -y tar libfontconfig curl ca-certificates && \
    mkdir -p "$GF_PATHS_HOME/.aws" && \
    curl "$GRAFANA_URL" | tar xfvz - --strip-components=1 -C "$GF_PATHS_HOME" && \
    apt-get autoremove -y && \
    rm -rf /var/lib/apt/lists/* && \
    groupadd -r -g $GF_GID grafana && \
    useradd -r -u $GF_UID -g grafana grafana && \
    mkdir -p "$GF_PATHS_PROVISIONING/datasources" \
             "$GF_PATHS_PROVISIONING/dashboards" \
             "$GF_PATHS_LOGS" \
             "$GF_PATHS_PLUGINS" \
             "$GF_PATHS_DATA" && \
    cp "$GF_PATHS_HOME/conf/sample.ini" "$GF_PATHS_CONFIG" && \
    cp "$GF_PATHS_HOME/conf/ldap.toml" /etc/grafana/ldap.toml && \
    chown -R grafana:grafana "$GF_PATHS_DATA" "$GF_PATHS_HOME/.aws" "$GF_PATHS_LOGS" "$GF_PATHS_PLUGINS" && \
    chmod 777 "$GF_PATHS_DATA" "$GF_PATHS_HOME/.aws" "$GF_PATHS_LOGS" "$GF_PATHS_PLUGINS"

RUN     apt-get update && apt-get -y install wget &&  \
        wget -qO - https://openresty.org/package/pubkey.gpg | apt-key add - && \
        apt-get -y install software-properties-common && \
        add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main" && \
        apt-get update && apt-get -y install openresty && \
        rm -rf /var/lib/apt/lists/*

RUN apt-get -yqq update
RUN apt-get install -yqq python
RUN apt-get -yqq install python-pip

EXPOSE 3000

ENV http_proxy=""
ENV https_proxy=""

COPY ./run.sh  /usr/local/openresty/nginx/conf/run.sh
COPY ./start-up.sh /start-up.sh
COPY ./grafana.ini /etc/grafana/grafana.ini
COPY ./openresty/nginx.conf /usr/local/openresty/nginx/conf
COPY ./py/* /usr/local/openresty/nginx/conf/
COPY ./plugin/* /var/lib/grafana/plugins


RUN chmod 777 -R /usr/local/openresty/nginx/ && \
    chmod 755 /start-up.sh && \
    mkdir /usr/local/openresty/nginx/client_body_temp && \
    chmod -R 777 /usr/local/openresty/nginx/client_body_temp && \
    rm -rf /usr/local/openresty/nginx/logs && mkdir /usr/local/openresty/nginx/logs && \
    chmod 777 -R /usr/local/openresty/nginx/logs && \
    touch /usr/local/openresty/nginx/logs/error.log && \
    chmod 777 /usr/local/openresty/nginx/logs/error.log && \
    chmod 777 -R /usr/local/openresty/nginx/conf/  && \
    chmod 777 /etc/grafana/grafana.ini


USER grafana
WORKDIR /
ENTRYPOINT [ "/start-up.sh" ]