nginx dockerfile

 

FROM nginx:1.22.1

MAINTAINER "muzhi"

RUN groupadd --system -g 2000 app \
    && useradd app --system -m -s /bin/bash -u 2000 -g 2000 \
    && usermod -a -G nginx app

WORKDIR /home/app

#COPY app/start.sh .
#COPY app/docker-entrypoint-init.d docker-entrypoint-init.d
#COPY app/docker-entrypoint.sh /usr/local/bin/

COPY etc/nginx/conf.d/default.conf /etc/nginx/conf.d/
COPY etc/nginx/nginx.conf /etc/nginx/

#RUN chmod +x /usr/local/bin/docker-entrypoint.sh \
#    && ln -s /usr/local/bin/docker-entrypoint.sh /entrypoint.sh

RUN mkdir -p /home/app/log && mkdir -p /var/run/nginx \
    && chown -R app:app /home/app/log \
    && chown -R nginx:nginx /var/log/nginx \
    && chown -R nginx:nginx /var/cache/nginx \
    && chown -R nginx:nginx /usr/lib/nginx \
    && chown -R nginx:nginx /var/cache/nginx \
    && chown -R nginx:nginx /var/run/nginx \
    && chmod -R 775 /var/cache/nginx \
    && chmod -R 775 /var/log/nginx \
    && chown nginx:nginx /usr/sbin/nginx \
    && chmod a+s /usr/sbin/nginx

USER nginx

#ENTRYPOINT ["docker-entrypoint.sh"]

 

 

FROM nginx:1.22.1

MAINTAINER "muzhi"

RUN cp /etc/apt/sources.list /etc/apt/sources.list.backup \
    && sed -i "s@http://\(deb\|security\).debian.org@https://mirrors.aliyun.com@g" /etc/apt/sources.list \
    && apt-get update && apt-get install -y apt-utils

RUN apt-get install -y vim wget telnet net-tools tcpdump

COPY etc/nginx/conf.d/default.conf /etc/nginx/conf.d/
COPY etc/nginx/nginx.conf /etc/nginx/

RUN mkdir -p /var/run/nginx && chown -R nginx:nginx /var/run/nginx \
    && chown -R nginx:nginx /var/cache/nginx \
    && chown -R nginx:nginx /var/log/nginx \
    && chown -R nginx:nginx /var/lib/nginx

USER nginx

 

posted @ 2023-04-12 08:42  牧之丨  阅读(48)  评论(0编辑  收藏  举报