FROM openresty/openresty:alpine # Install dependencies needed by opm RUN apk add --no-cache curl perl # Install lua-resty-http RUN opm get ledgetech/lua-resty-http # Copy configuration COPY nginx.conf /usr/local/openresty/nginx/conf/nginx.conf COPY lua /usr/local/openresty/nginx/lua # Create uploads directory structure with proper permissions RUN mkdir -p /app/uploads/avatars && \ chmod -R 755 /app/uploads # Create nginx temp directories RUN mkdir -p /var/cache/nginx/client_temp \ /var/cache/nginx/proxy_temp \ /var/cache/nginx/fastcgi_temp \ /var/cache/nginx/uwsgi_temp \ /var/cache/nginx/scgi_temp && \ chmod -R 755 /var/cache/nginx EXPOSE 80 443 # Run as root but nginx will drop privileges after binding to ports CMD ["/usr/local/openresty/bin/openresty", "-g", "daemon off;"]