FROM openresty/openresty:alpine # Install dependencies needed by opm and thumbnail generation RUN apk add --no-cache curl perl ffmpeg # Install lua-resty-http RUN opm get ledgetech/lua-resty-http # Install lua-resty-jwt for edge JWT validation RUN opm get SkyLothar/lua-resty-jwt # 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 /app/uploads/stickers /app/uploads/sticker-submissions && \ 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 # Create startup script inline to avoid Windows line ending issues RUN printf '#!/bin/sh\nmkdir -p /tmp/thumbs\nchmod 777 /tmp/thumbs\nexec /usr/local/openresty/bin/openresty -g "daemon off;"\n' > /start.sh && chmod +x /start.sh EXPOSE 80 443 # Use startup script to ensure proper permissions on /tmp/thumbs CMD ["/start.sh"]