|
| 1 | +FROM debian:buster |
| 2 | + |
| 3 | +# ------------------------------------------------------------------------ |
| 4 | +# Install requirements |
| 5 | +# ------------------------------------------------------------------------ |
| 6 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 7 | + vim \ |
| 8 | + sudo \ |
| 9 | + curl \ |
| 10 | + wget \ |
| 11 | + supervisor |
| 12 | + |
| 13 | +# ------------------------------------------------------------------------ |
| 14 | +# Install OpenResty |
| 15 | +# See: https://openresty.org/cn/installation.html |
| 16 | +# See: https://openresty.org/cn/linux-packages.html |
| 17 | +# ------------------------------------------------------------------------ |
| 18 | +RUN addgroup --system --gid 101 nginx |
| 19 | +RUN adduser --system --disabled-login --ingroup nginx --no-create-home --home \ |
| 20 | + /nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx |
| 21 | +RUN apt-get -y install --no-install-recommends wget gnupg ca-certificates |
| 22 | +RUN wget --no-check-certificate -O - https://openresty.org/package/pubkey.gpg | sudo apt-key add - |
| 23 | +RUN apt-get -y install --no-install-recommends software-properties-common |
| 24 | +RUN codename=`grep -Po 'VERSION="[0-9]+ \(\K[^)]+' /etc/os-release` && \ |
| 25 | + arch=$(arch | sed s/aarch64/arm64\\// | sed s/x86_64//) && \ |
| 26 | + echo "deb http://openresty.org/package/${arch}debian $codename openresty" \ |
| 27 | + | sudo tee /etc/apt/sources.list.d/openresty.list |
| 28 | +RUN apt-get update && apt-get -y install openresty |
| 29 | + |
| 30 | +# ------------------------------------------------------------------------ |
| 31 | +# Install openresty lua package: lua-resty-jwt |
| 32 | +# See: https://github.com/SkyLothar/lua-resty-jwt |
| 33 | +# ------------------------------------------------------------------------ |
| 34 | +RUN opm get SkyLothar/lua-resty-jwt |
| 35 | + |
| 36 | +# ------------------------------------------------------------------------ |
| 37 | +# Supervisor Configuration |
| 38 | +# ------------------------------------------------------------------------ |
| 39 | +SHELL ["/bin/bash", "-c"] |
| 40 | +RUN echo $'[program:nginx] \n\ |
| 41 | +command=/usr/local/openresty/nginx/sbin/nginx -c /usr/local/openresty/nginx/conf/nginx.conf -g "daemon off;" \n\ |
| 42 | +process_name=%(program_name)s \n\ |
| 43 | +numprocs=1 \n\ |
| 44 | +startsecs=3 \n\ |
| 45 | +autostart=true \n\ |
| 46 | +autorestart=true \n\ |
| 47 | +priority=999 \n\ |
| 48 | +user=root \n\ |
| 49 | +umask=0000 \n\ |
| 50 | +stdout_logfile=/dev/stdout \n\ |
| 51 | +stderr_logfile=/dev/stdout \n\ |
| 52 | +stdout_logfile_maxbytes=0 \n\ |
| 53 | +stderr_logfile_maxbytes=0 \n\ |
| 54 | +' > /etc/supervisor/conf.d/nginx.conf |
| 55 | + |
| 56 | +# ------------------------------------------------------------------------ |
| 57 | +# Start Services |
| 58 | +# ------------------------------------------------------------------------ |
| 59 | +RUN mkdir -p /data/storage/logs |
| 60 | + |
| 61 | +WORKDIR /data |
| 62 | + |
| 63 | +STOPSIGNAL SIGQUIT |
| 64 | + |
| 65 | +CMD ["supervisord", "--nodaemon"] |
0 commit comments