Dockerfile文件:
FROM centos:latest
RUN yum install -y pcre-devel openssl-devel gcc curl wget perl make
cd ~
wget https://openresty.org/download/openresty-1.15.8.1.tar.gz
tar -xzvf openresty-1.15.8.1.tar.gz
cd openresty-1.15.8.1
./configure
gmake
gmake install
RUN PATH=$PATH:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin/
RUN mkdir -p /lua
RUN mkdir -p /usr/local/openresty/nginx/conf/conf.d
RUN nginx &
EXPOSE 80 443
docker-compose.yml文件:
version: '3.3'
services:
openresty:
build: ./dockerfile/openresty
image: phonecom/openresty
restart: always
privileged: true
ports:
- "8888:80"
- "4430:443"
volumes:
- "./etc/openresty/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf"
- "./etc/openresty/conf.d:/usr/local/openresty/nginx/conf/conf.d"
- "./project/lua:/lua"
command:
- /bin/sh
- -c
- |
while true;do sleep 100;done